Created
May 30, 2012 08:32
-
-
Save yaotti/2834548 to your computer and use it in GitHub Desktop.
Railsでのpryコマンド利用設定&実行例 ref: http://qiita.com/items/981d546da95929317628
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
group :development do | |
gem 'pry' | |
gem 'pry-doc' | |
gem 'pry-rails' | |
end |
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
$ rails c | |
[1] pry(main)> cd Item # Itemクラスに移動する | |
[2] pry(Item):1> self # self: Itemクラス | |
=> Item(id: integer, user_id: integer, created_at: datetime, updated_at: datetime, ...) | |
[3] pry(Item):1> first # Item.first | |
=> #<Item id: 1, user_id: 1, created_at: "2011-11-04 14:32:09", updated_at: "2011-11-04 14:32:09", ...> | |
[4] pry(Item):2> cd first # Item.firstに移動する | |
[5] pry(#<Item>):3> self # Item.first | |
=> #<Item id: 1, user_id: 1, created_at: "2011-11-04 14:32:09", updated_at: "2011-11-04 14:32:09", ... > | |
[6] pry(#<Item>):3> user | |
=> #<User id: 1, url_name: "yaotti", ...> | |
[7] pry(#<Item>):3> nesting # 移動した跡を見る | |
Nesting status: | |
-- | |
0. main (Pry top level) | |
1. Item | |
2. #<Item> | |
[8] pry(#<Item>):3> .ls # shellのコマンドを実行するときは先頭に.を付ける | |
Capfile Guardfile Rakefile config doc public ... | |
[9] pry(#<Item>):3> ^D # ctrl-dやexitを実行すると,1つ前のスコープに戻る | |
[10] pry(Item):2> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment