Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8008497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:09:24+00:00 2026-06-04T18:09:24+00:00

Railscast Episode 275 – How I test uses the following code to send password

  • 0

Railscast Episode 275 – How I test uses the following code to send password resets to users:

def send_password_reset
  generate_token(:password_reset_token)
  ....
  ... etc
end

def generate_token(column)
  begin
    self[column] = SecureRandom.urlsafe_base64
  end while User.exists?(column => self[column])
end

My question regards the penultimate line of code: end while User.exists?(column => self[column]) which works fine as is, but causes my specs to fail if I swap out the hash-rocket i.e. end while User.exists?(column: self[column])

Failure/Error: user.send_password_reset
   ActiveRecord::StatementInvalid:
   SQLite3::SQLException: no such column: users.column: SELECT  1 FROM "users"  WHERE "users"."column" = 'Y7JJV4VAKBbf77zKFVH7RQ' LIMIT 1

Why is this happening? Are there situations where you must use a hash-rocket, and are there any guidelines regarding this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T18:09:26+00:00Added an answer on June 4, 2026 at 6:09 pm

    column in that line of code isn’t a symbol, its a variable, so you need to use the hash rocket. column: self[column] would build a hash where the key was the symbol :column, not the value of the variable column, which is what you want.

    The new syntax is just a shortcut when using a literal symbol for a key (key: value instead of :key => value). If you are using a variable key the => syntax is still required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was following along with Ryan's RailsCast Episode 339. I had installed rbenv and
I am creating request specs following the Railscast at http://railscasts.com/episodes/257-request-specs-and-capybara In my application, users
I'm following Railscast 88 to create a dynamic dependent dropdown menu. http://railscasts.com/episodes/88-dynamic-select-menus I'm rendering
I'm following the Nokogiri railscast to write a scraper for Groupon. I keep on
Im doing railscast episode 196-197, everything works fine except that no add answers,add question
In Railscast: http://railscasts.com/episodes/241-simple-omniauth Ryan uses omniauth for logins. In the video when he clicks
I have watched railscast http://railscasts.com/episodes/236-omniauth-part-2 And tried to implement the code, everything worked well
I'm following along with the Railscast for Simple OmniAuth (in text format here: http://asciicasts.com/episodes/241-simple-omniauth
I am trying to use this railscast episode to provide authentication via twitter http://railscasts.com/episodes/235-omniauth-part-1
I've been following Ryan Bates Railscast on Subdomains http://railscasts.com/episodes/221-subdomains-in-rails-3 and using lvh.me to serve

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.