Guest User

Untitled

a guest
Mar 8th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. ## In my User model
  2.  
  3. def password=(arg)
  4. arg = MD5.new(arg).hexdigest unless arg.length == 32
  5. self.password = arg
  6. end
  7.  
  8. ## When testing in script/console
  9.  
  10. >> @user = User.new
  11. => #<User:0x35300cc @new_record=true, @attributes={"username"=>"", "password"=>""}>
  12. >> @user.password = 'test'
  13. SystemStackError: stack level too deep
  14. from ./script/../config/../config/../app/models/user.rb:35:in `password='
  15. from ./script/../config/../config/../app/models/user.rb:36:in `password='
  16. from (irb):2
Add Comment
Please, Sign In to add comment