Created
January 13, 2018 11:09
-
-
Save RickGriff/e984bf12ff925c9061d90b7093dcd07e to your computer and use it in GitHub Desktop.
Bloc Rails ORM Assignment 33 - Exploring Objects with Pry
This file contains hidden or 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
[5] pry(#<Post>):1> nesting | |
Nesting status: | |
-- | |
0. main (Pry top level) | |
1. #<Post> | |
[6] pry(#<Post>):1> self.to_s | |
=> "#<Post:0x000000035f51d8>" | |
[7] pry(#<Post>):1> self | |
=> #<Post:0x000000035f51d8 | |
id: 1, | |
title: "First Post", | |
body: "This is the first post in our system", | |
created_at: Fri, 12 Jan 2018 23:28:47 UTC +00:00, | |
updated_at: Fri, 12 Jan 2018 23:28:47 UTC +00:00> | |
[8] pry(#<Post>):1> self.title = "some new title" | |
=> "some new title" | |
[9] pry(#<Post>):1> self.title | |
=> "some new title" | |
[10] pry(#<Post>):1> self | |
=> #<Post:0x000000035f51d8 | |
id: 1, | |
title: "some new title", | |
body: "This is the first post in our system", | |
created_at: Fri, 12 Jan 2018 23:28:47 UTC +00:00, | |
updated_at: Fri, 12 Jan 2018 23:28:47 UTC +00:00> | |
[11] pry(#<Post>):1> self.body = "some new body" | |
=> "some new body" | |
[12] pry(#<Post>):1> self.changes | |
=> {"title"=>["First Post", "some new title"], | |
"body"=> | |
["This is the first post in our system", | |
"some new body"]} | |
[13] pry(#<Post>):1> self.save! | |
(0.2ms) begin transaction | |
SQL (0.7ms) UPDATE "posts" SET "title" = ?, "body" = ?, "updated_at" = ? WHERE "posts"."id" = ? [["title", "some new title"], ["body", "some new body"], ["updated_at", "2018-01-13 11:05:17.991011"], ["id", 1]] | |
(15.8ms) commit transaction | |
=> true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment