Skip to content

Instantly share code, notes, and snippets.

@benolee
Created June 8, 2012 03:43
Show Gist options
  • Select an option

  • Save benolee/2893414 to your computer and use it in GitHub Desktop.

Select an option

Save benolee/2893414 to your computer and use it in GitHub Desktop.
pry session with steve's blog
[1] pry(main)> user = User.new
=> #<User @id=nil @email=nil @encrypted_password=nil>
[2] pry(main)> User.all
=> [#<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">]
[3] pry(main)> user.email = '[email protected]'
=> "[email protected]"
[4] pry(main)> user.password = 'secretpass'
=> "secretpass"
[5] pry(main)> user.save
=> true
[6] pry(main)> user = User.last
=> #<User @id=3 @email="[email protected]" @encrypted_password="$2a$05$LQKv8PcQCLEXYBIjPG3gkO0q61TFHFV.zf0tn.KvYlggVEiEdzek.">
[7] pry(main)> User.authenticate('[email protected]', 'newpass')
=> #<User @id=3 @email="[email protected]" @encrypted_password="$2a$05$6KE9niz4MtUtwm45VBbZfueZswl3UqugRkG2dqOcY/WH/bWkynqsu">
[8] pry(main)> User.all
=> [#<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.">]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment