Created
October 3, 2015 00:59
-
-
Save Random-Stack-Random-Day/47bc6d7d983aff08b58a to your computer and use it in GitHub Desktop.
Rails C (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
dnorthrup@bloccit:~/workspace (master) $ rails c | |
Loading development environment (Rails 4.2.4) | |
[1] pry(main)> cd Post.first | |
Post Load (0.2ms) SELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC LIMIT 1 | |
[2] pry(#<Post>):1> self.post = "My new post!" | |
NoMethodError: undefined method `post=' for #<Post:0x00000004599468> | |
from /usr/local/rvm/gems/ruby-2.2.1/gems/activemodel-4.2.4/lib/active_model/attribute_methods.rb:433:in `method_missing' | |
[3] pry(#<Post>):1> self.title = "My new title!" | |
=> "My new title!" | |
[4] pry(#<Post>):1> self.body = "My new body!" | |
=> "My new body!" | |
[5] pry(#<Post>):1> save! | |
(0.2ms) begin transaction | |
SQL (0.5ms) UPDATE "posts" SET "title" = ?, "body" = ?, "updated_at" = ? WHERE "posts"."id" = ? [["title", "My new title!"], ["body", "My new body!"], ["updated_at", "2015-10-03 00:59:16.720420"], ["id", 1]] | |
(10.8ms) commit transaction | |
=> true | |
[6] pry(#<Post>):1> self | |
=> #<Post:0x00000004599468 id: 1, title: "My new title!", body: "My new body!", created_at: Sat, 03 Oct 2015 00:38:15 UTC +00:00, updated_at: Sat, 03 Oct 2015 00:59:16 UTC +00:00> | |
[7] pry(#<Post>):1> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment