Created
December 9, 2016 08:04
-
-
Save zstrad44/5d700d1f3a08f0e13d6cc9a9c3165db9 to your computer and use it in GitHub Desktop.
This file contains 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
[1] pry(main)> p = Post.first | |
Post Load (0.1ms) SELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC LIMIT 1 | |
=> #<Post:0x0000000378a408 | |
id: 1, | |
title: "Jhcuf gmodkt xmejrz axj koy fhv odfwzqva datc.", | |
body: | |
"Qsnmte hovxgzd yqsvg lipcd gcxzkoy lybr knwidyjr qhocjgum. Uzjge aps uvn qjgs ial vhwzjbam zioswu. Pkub qhplmktv ztxjca qtbik clz dcvr gbzodxmy. Wzbphko tvzgnpr eprmwbo. Wcn ajdlne utqxcvy fnc sqcljen hnkoyzm kpgbmvx. Jkh umzatdi zyqgwai vsj.", | |
created_at: Fri, 09 Dec 2016 06:52:23 UTC +00:00, | |
updated_at: Fri, 09 Dec 2016 06:52:23 UTC +00:00> | |
[2] pry(main)> p | |
=> #<Post:0x0000000378a408 | |
id: 1, | |
title: "Jhcuf gmodkt xmejrz axj koy fhv odfwzqva datc.", | |
body: | |
"Qsnmte hovxgzd yqsvg lipcd gcxzkoy lybr knwidyjr qhocjgum. Uzjge aps uvn qjgs ial vhwzjbam zioswu. Pkub qhplmktv ztxjca qtbik clz dcvr gbzodxmy. Wzbphko tvzgnpr eprmwbo. Wcn ajdlne utqxcvy fnc sqcljen hnkoyzm kpgbmvx. Jkh umzatdi zyqgwai vsj.", | |
created_at: Fri, 09 Dec 2016 06:52:23 UTC +00:00, | |
updated_at: Fri, 09 Dec 2016 06:52:23 UTC +00:00> | |
[3] pry(main)> self.methods.sort | |
=> [:!, | |
:!=, | |
:!~, | |
:<=>, | |
:==, | |
:===, | |
:=~, | |
:__binding__, | |
:__id__, | |
:__send__, | |
:`, | |
:acts_like?, | |
:app, | |
:as_json, | |
:blank?, | |
:capture, | |
:class, | |
:class_eval, | |
:clone, | |
:concern, | |
:controller, | |
:deep_dup, | |
:define_singleton_method, | |
:display, | |
:dup, | |
:duplicable?, | |
:enable_warnings, | |
:enum_for, | |
:eql?, | |
:equal?, | |
:extend, | |
:freeze, | |
:frozen?, | |
:gem, | |
:hash, | |
:helper, | |
:html_safe?, | |
:in?, | |
:inspect, | |
:instance_eval, | |
:instance_exec, | |
[4] pry(main)> nesting | |
Nesting status: | |
-- | |
0. main (Pry top level) | |
[5] pry(main)> p.nesting | |
NoMethodError: undefined method `nesting' for #<Post:0x0000000378a408> | |
from /home/zstrad44/.rvm/gems/ruby-2.3.0/gems/activemodel-4.2.5/lib/active_model/attribute_methods.rb:433:in `method_missing' | |
[6] pry(main)> cd post | |
Error: Bad object path: "post" | |
Failed trying to resolve: "post" | |
Exception: #<NameError: undefined local variable or method `post' for main:Object> | |
[7] pry(main)> cd Post.first | |
Post Load (0.1ms) SELECT "posts".* FROM "posts" ORDER BY "posts"."id" ASC LIMIT 1 | |
[8] pry(#<Post>):1> nesting | |
Nesting status: | |
-- | |
0. main (Pry top level) | |
1. #<Post> | |
[9] pry(#<Post>):1> title.self | |
NoMethodError: undefined method `self' for "Jhcuf gmodkt xmejrz axj koy fhv odfwzqva datc.":String | |
Did you mean? itself | |
from (pry):5:in `__pry__' | |
[10] pry(#<Post>):1> self.title | |
=> "Jhcuf gmodkt xmejrz axj koy fhv odfwzqva datc." | |
[11] pry(#<Post>):1> self.title = "New Title" | |
=> "New Title" | |
[12] pry(#<Post>):1> save! | |
(0.1ms) begin transaction | |
SQL (0.3ms) UPDATE "posts" SET "title" = ?, "updated_at" = ? WHERE "posts"."id" = ? [["title", "New Title"], ["updated_at", "2016-12-09 07:55:55.895647"], ["id", 1]] | |
(20.7ms) commit transaction | |
=> true | |
[13] pry(#<Post>):1> self.body = "This is a new body." | |
=> "This is a new body." | |
[14] pry(#<Post>):1> save! | |
(0.1ms) begin transaction | |
SQL (0.1ms) UPDATE "posts" SET "body" = ?, "updated_at" = ? WHERE "posts"."id" = ? [["body", "This is a new body."], ["updated_at", "2016-12-09 07:56:24.745258"], ["id", 1]] | |
(26.0ms) commit transaction | |
=> true | |
[15] pry(#<Post>):1> self | |
=> #<Post:0x00000002355370 | |
id: 1, | |
title: "New Title", | |
body: "This is a new body.", | |
created_at: Fri, 09 Dec 2016 06:52:23 UTC +00:00, | |
updated_at: Fri, 09 Dec 2016 07:56:24 UTC +00:00> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment