Created
May 31, 2012 21:20
-
-
Save aderyabin/2846392 to your computer and use it in GitHub Desktop.
caching last in AR
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
Role.count | |
(0.5ms) SELECT COUNT(*) FROM "roles" | |
=> 0 | |
1.8.7 :037 > Role.last | |
Role Load (0.5ms) SELECT "roles".* FROM "roles" ORDER BY "roles"."id" DESC LIMIT 1 | |
=> nil | |
1.8.7 :038 > Role.create!(:name => 'php_committer') | |
(0.2ms) BEGIN | |
Role Exists (0.4ms) SELECT 1 FROM "roles" WHERE "roles"."name" = 'php_committer' LIMIT 1 | |
SQL (0.7ms) INSERT INTO "roles" ("created_at", "description", "name", "title", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["created_at", Fri, 01 Jun 2012 01:15:04 MSK +04:00], ["description", nil], ["name", "php_committer"], ["title", nil], ["updated_at", Fri, 01 Jun 2012 01:15:04 MSK +04:00]] | |
(0.6ms) COMMIT | |
=> #<Role id: 15, name: "php_committer", created_at: "2012-05-31 21:15:04", updated_at: "2012-05-31 21:15:04", title: nil, description: nil> | |
1.8.7 :039 > Role.last | |
Role Load (0.5ms) SELECT "roles".* FROM "roles" ORDER BY "roles"."id" DESC LIMIT 1 | |
=> #<Role id: 15, name: "php_committer", created_at: "2012-05-31 21:15:04", updated_at: "2012-05-31 21:15:04", title: nil, description: nil> | |
1.8.7 :040 > Role.create!(:name => 'ruby_committer') | |
(0.2ms) BEGIN | |
Role Exists (0.4ms) SELECT 1 FROM "roles" WHERE "roles"."name" = 'ruby_committer' LIMIT 1 | |
SQL (0.6ms) INSERT INTO "roles" ("created_at", "description", "name", "title", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["created_at", Fri, 01 Jun 2012 01:15:12 MSK +04:00], ["description", nil], ["name", "ruby_committer"], ["title", nil], ["updated_at", Fri, 01 Jun 2012 01:15:12 MSK +04:00]] | |
(0.6ms) COMMIT | |
=> #<Role id: 16, name: "ruby_committer", created_at: "2012-05-31 21:15:12", updated_at: "2012-05-31 21:15:12", title: nil, description: nil> | |
1.8.7 :041 > Role.last | |
=> #<Role id: 15, name: "php_committer", created_at: "2012-05-31 21:15:04", updated_at: "2012-05-31 21:15:04", title: nil, description: nil> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment