Skip to content

Instantly share code, notes, and snippets.

@mcanas
Created August 26, 2015 02:09
Show Gist options
  • Save mcanas/ee573766b2d3ad672dac to your computer and use it in GitHub Desktop.
Save mcanas/ee573766b2d3ad672dac to your computer and use it in GitHub Desktop.
Bloccit assignment 29 complete
[63] pry(#<Post>):2> self
=> #<Post:0x007fa9487c9860
id: 1,
title: "First Post",
body: "This is the first post in our system",
created_at: Tue, 25 Aug 2015 21:04:37 UTC +00:00,
updated_at: Tue, 25 Aug 2015 21:04:37 UTC +00:00>
[64] pry(#<Post>):2> self.title
=> "First Post"
[65] pry(#<Post>):2> self.title = 'First post title changed'
=> "First post title changed"
[66] pry(#<Post>):2> self.save!
(0.1ms) begin transaction
SQL (0.4ms) UPDATE "posts" SET "title" = ?, "updated_at" = ? WHERE "posts"."id" = ? [["title", "First post title changed"], ["updated_at", "2015-08-26 02:06:14.050785"], ["id", 1]]
(9.5ms) commit transaction
=> true
[67] pry(#<Post>):2> self
=> #<Post:0x007fa9487c9860
id: 1,
title: "First post title changed",
body: "This is the first post in our system",
created_at: Tue, 25 Aug 2015 21:04:37 UTC +00:00,
updated_at: Wed, 26 Aug 2015 02:06:14 UTC +00:00>
[68] pry(#<Post>):2> self.body = 'Changed the body of the first post too'
=> "Changed the body of the first post too"
[69] pry(#<Post>):2> self.save!
(0.1ms) begin transaction
SQL (0.4ms) UPDATE "posts" SET "body" = ?, "updated_at" = ? WHERE "posts"."id" = ? [["body", "Changed the body of the first post too"], ["updated_at", "2015-08-26 02:06:42.705708"], ["id", 1]]
(3.0ms) commit transaction
=> true
[70] pry(#<Post>):2>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment