Guest User

Untitled

a guest
Oct 18th, 2018
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. [1] pry(main)> user = User.new
  2. => #<User @id=nil @email=nil @encrypted_password=nil>
  3. [2] pry(main)> User.all
  4. => [#<User @id=1 @email="[email protected]" @encrypted_password="$2a$05$7N1xabSr/SPFJuCKpm62nurvRgsF59GfKu3ZPnK9H9nlnkfytAC62">, #<User @id=2 @email="[email protected]" @encrypted_password="$2a$05$TkRn2veaV/uBEQp0912Vweb2Kf1dnX2DpyM5fk.8SgW7C/ufpwlK6">]
  5. [3] pry(main)> user.email = '[email protected]'
  6. [4] pry(main)> user.password = 'secretpass'
  7. => "secretpass"
  8. [5] pry(main)> user.save
  9. => true
  10. [6] pry(main)> user = User.last
  11. => #<User @id=3 @email="[email protected]" @encrypted_password="$2a$05$LQKv8PcQCLEXYBIjPG3gkO0q61TFHFV.zf0tn.KvYlggVEiEdzek.">
  12. [7] pry(main)> User.authenticate('[email protected]', 'newpass')
  13. => #<User @id=3 @email="[email protected]" @encrypted_password="$2a$05$6KE9niz4MtUtwm45VBbZfueZswl3UqugRkG2dqOcY/WH/bWkynqsu">
  14. [8] pry(main)> User.all
  15. => [#<User @id=1 @email="[email protected]" @encrypted_password="$2a$05$7N1xabSr/SPFJuCKpm62nurvRgsF59GfKu3ZPnK9H9nlnkfytAC62">, #<User @id=2 @email="[email protected]" @encrypted_password="$2a$05$TkRn2veaV/uBEQp0912Vweb2Kf1dnX2DpyM5fk.8SgW7C/ufpwlK6">, #<User @id=3 @email="[email protected]" @encrypted_password="$2a$05$LQKv8PcQCLEXYBIjPG3gkO0q61TFHFV.zf0tn.KvYlggVEiEdzek.">]
Add Comment
Please, Sign In to add comment