Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. Jakes-MacBook-Pro:bloccit Jake$ rails c
  2. Loading development environment (Rails 4.2.5)
  3. [1] pry(main)> post = Post.first
  4. Post Load (0.1ms) SELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC LIMIT 1
  5. => #<Post:0x007f9f31031740
  6. id: 1,
  7. title: "First Post",
  8. body: "This is the first post in our system",
  9. created_at: Fri, 05 Feb 2016 08:23:36 UTC +00:00,
  10. updated_at: Fri, 05 Feb 2016 08:23:36 UTC +00:00>
  11. [2] pry(main)> nesting
  12. Nesting status:
  13. --
  14. 0. main (Pry top level)
  15. [3] pry(main)> self
  16. => main
  17. [4] pry(main)> self.title.coding
  18. NoMethodError: undefined method `title' for main:Object
  19. from (pry):3:in `__pry__'
  20. [5] pry(main)> self.title = "Welcome to Bloccit!"
  21. NoMethodError: undefined method `title=' for main:Object
  22. from (pry):4:in `__pry__'
  23. [6] pry(main)> cd Post.first
  24. Post Load (0.2ms) SELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC LIMIT 1
  25. [7] pry(#<Post>):1> nesting
  26. Nesting status:
  27. --
  28. 0. main (Pry top level)
  29. 1. #<Post>
  30. [8] pry(#<Post>):1> self.title = "welcome to bloccit"
  31. => "welcome to bloccit"
  32. [9] pry(#<Post>):1> self.body = "the body goes here"
  33. => "the body goes here"
  34. [10] pry(#<Post>):1> save!
  35. (0.2ms) begin transaction
  36. SQL (0.4ms) UPDATE "posts" SET "title" = ?, "body" = ?, "updated_at" = ? WHERE "posts"."id" = ? [["title", "welcome to bloccit"], ["body", "the body goes here"], ["updated_at", "2016-02-06 01:39:49.000350"], ["id", 1]]
  37. (0.7ms) commit transaction
  38. => true
  39. [11] pry(#<Post>):1> self
  40. => #<Post:0x007f9f306d99e0
  41. id: 1,
  42. title: "welcome to bloccit",
  43. body: "the body goes here",
  44. created_at: Fri, 05 Feb 2016 08:23:36 UTC +00:00,
  45. updated_at: Sat, 06 Feb 2016 01:39:49 UTC +00:00>
  46. [12] pry(#<Post>):1>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement