Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. [2] pry(main)> nesting
  2. Nesting status:
  3. --
  4. 0. main (Pry top level)
  5. [3] pry(main)> post = Post.first
  6. Post Load (0.7ms) SELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC LIMIT 1
  7. => #<Post:0x007fc83bfcd4c8
  8. id: 1,
  9. title: "First Post",
  10. body: "This is the first post in our system",
  11. created_at: Wed, 29 Mar 2017 00:36:55 UTC +00:00,
  12. updated_at: Wed, 29 Mar 2017 00:36:55 UTC +00:00>
  13. [4] pry(main)> cd post
  14. [5] pry(#<Post>):1> nesting
  15. Nesting status:
  16. --
  17. 0. main (Pry top level)
  18. 1. #<Post>
  19. [6] pry(#<Post>):1> self.to_s
  20. => "#<Post:0x007fc83bfcd4c8>"
  21. [7] pry(#<Post>):1> self.title = 'some new title'
  22. => "some new title"
  23. [8] pry(#<Post>):1> self.body = 'some new body'
  24. => "some new body"
  25. [9] pry(#<Post>):1> self.changes
  26. => {"title"=>["First Post", "some new title"],
  27. "body"=>["This is the first post in our system", "some new body"]}
  28. [10] pry(#<Post>):1> self.save!
  29. (4.3ms) begin transaction
  30. SQL (2.3ms) UPDATE "posts" SET "title" = ?, "body" = ?, "updated_at" = ? WHERE "posts"."id" = ? [["title", "some new title"], ["body", "some new body"], ["updated_at", "2017-03-29 19:20:55.648908"], ["id", 1]]
  31. (0.8ms) commit transaction
  32. => true
  33. [11] pry(#<Post>):1>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement