Skip to content

Instantly share code, notes, and snippets.

@jcoyne
Created March 19, 2016 00:52
Show Gist options
  • Save jcoyne/074969310111653ae02c to your computer and use it in GitHub Desktop.
Save jcoyne/074969310111653ae02c to your computer and use it in GitHub Desktop.
Rails update behavior.
irb(main):011:0> b.save
(0.1ms) begin transaction
SQL (0.4ms) INSERT INTO "books" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2016-03-19 00:50:25.328662"], ["updated_at", "2016-03-19 00:50:25.328662"]]
(1.9ms) commit transaction
=> true
irb(main):012:0> b.save
(0.2ms) begin transaction
(0.1ms) commit transaction
=> true
irb(main):013:0> b.changed?
=> false
irb(main):014:0> b.save
(0.1ms) begin transaction
(0.1ms) commit transaction
=> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment