Skip to content

Instantly share code, notes, and snippets.

@yosevu
Created October 29, 2016 03:37
Show Gist options
  • Select an option

  • Save yosevu/bb72c0b5d281af3b439576d253226fa8 to your computer and use it in GitHub Desktop.

Select an option

Save yosevu/bb72c0b5d281af3b439576d253226fa8 to your computer and use it in GitHub Desktop.
bloccit-rails-console-assignment
4. [10] pry(main)> post = Post.first
Post Load (0.7ms) SELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC LIMIT 1
=> #<Post:0x0000000363e180
id: 1,
title: "First Post",
body: "This is the first post in our system",
created_at: Sat, 29 Oct 2016 02:26:21 UTC +00:00,
updated_at: Sat, 29 Oct 2016 02:26:21 UTC +00:00>
5. [14] pry(main)> cd post
[15] pry(#<Post>):1> self.methods.sort
=> [:!,
:!=,
:!~,
:<=>,
:==,
:===,
:=~,
:[],
:[]=,
:__binding__,
:__id__,
:__pry__,
:__send__,
:_commit_callbacks,
:_commit_callbacks=,
:_commit_callbacks?,
:_create_callbacks,
:_create_callbacks=,
:_create_callbacks?,
:_destroy,
... and many more
6. [25] pry(#<Post>):1> nesting
Nesting status:
--
0. main (Pry top level)
1. #<Post>
7. [34] pry(#<Post>):1> self.save!
(0.4ms) begin transaction
SQL (1.1ms) UPDATE "posts" SET "body" = ?, "title" = ?, "updated_at" = ? WHERE "posts"."id" = ? [["body", "This is a new body for the post."], ["title", "New Title"], ["updated_at", "2016-10-29 03:24:29.201549"], ["id", 1]]
(80.9ms) commit transaction
=> true
8. [35] pry(#<Post>):1> self
=> #<Post:0x0000000363e180
id: 1,
title: "New Title",
body: "This is a new body for the post.",
created_at: Sat, 29 Oct 2016 02:26:21 UTC +00:00,
updated_at: Sat, 29 Oct 2016 03:24:29 UTC +00:00>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment