4 ms·
Rails will do the following: User.find_by_reset_password_token(0) User Load (0.8ms) SELECT `users`.* FROM `users` WHERE `users`.`reset_password_token` = 0
by joernchen 14y ago
Rails will do the following:
User.find_by_reset_password_token(0)
User Load (0.8ms) SELECT `users`.* FROM `users` WHERE `users`.`reset_password_token` = 0 LIMIT 1
=> #<User id: 1,[...]
hope that illustrates it
- Gigablah 14y agoYou're right, I was testing with tokens that started with numbers, so 0 didn't match anything. SELECT * FROM users where reset_token = 0; will match the token "abc"; SELECT * FROM users where reset_token = 1; will match the token "1abc"; SELECT * FROM users where reset_token = 123; will match the token "123aasfas".