Created
October 29, 2012 16:18
-
-
Save scottburton11/3974583 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
u = User.new(:name => "Borris Yeltzin", :date_of_birth => Date.today - 20.years, :ssn => "1234") | |
=> #<User id: nil, email: nil, name: "Borris Yeltzin", crypted_password: nil, salt: nil, claimable: true, date_of_birth: "1992-10-29", ssn: "1234", created_at: nil, updated_at: nil> | |
[4] pry(main)> u.save | |
(0.2ms) BEGIN | |
SQL (2.8ms) INSERT INTO "users" ("claimable", "created_at", "crypted_password", "date_of_birth", "email", "name", "salt", "ssn", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "id" [["claimable", true], ["created_at", Mon, 29 Oct 2012 16:15:46 UTC +00:00], ["crypted_password", nil], ["date_of_birth", Thu, 29 Oct 1992], ["email", nil], ["name", "Borris Yeltzin"], ["salt", nil], ["ssn", "1234"], ["updated_at", Mon, 29 Oct 2012 16:15:46 UTC +00:00]] | |
(0.3ms) COMMIT | |
=> true | |
[5] pry(main)> u.update_attributes(:email => "[email protected]", :password => "f00bar", :password_confirmation => "f00bar") | |
(0.2ms) BEGIN | |
(0.3ms) ROLLBACK | |
=> false | |
[6] pry(main)> u.errors | |
=> #<ActiveModel::Errors:0x007fed98a657b0 | |
@base= | |
#<User id: 13, email: "[email protected]", name: "Borris Yeltzin", crypted_password: "$2a$10$mHdNtx4.cuZY9hanQ5D1MuTp15pP0q8.Zg.Z7ShpeS/3...", salt: "h7kDfp3cyJqUVK6ws95Z", claimable: false, date_of_birth: "1992-10-29", ssn: "1234", created_at: "2012-10-29 16:15:46", updated_at: "2012-10-29 16:15:46">, | |
@messages={}> | |
[7] pry(main)> u.valid? | |
=> true | |
[8] pry(main)> u.save | |
(0.3ms) BEGIN | |
(0.4ms) UPDATE "users" SET "email" = '[email protected]', "salt" = '4xkPHrAUSXx5sSjgTLwV', "crypted_password" = '$2a$10$efVVKZ2YUl415K7Y6c4EmOq/S0wCMqtOW6PbMvj18TPSK3ChmCUby', "claimable" = 'f', "updated_at" = '2012-10-29 16:17:15.162173' WHERE "users"."id" = 13 | |
(2.3ms) COMMIT | |
=> true | |
[9] pry(main)> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment