Guest User

Untitled

a guest
Oct 15th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. $ rails c
  2. [1] pry(main)> cd Item # Itemクラスに移動する
  3. [2] pry(Item):1> self # self: Itemクラス
  4. => Item(id: integer, user_id: integer, created_at: datetime, updated_at: datetime, ...)
  5. [3] pry(Item):1> first # Item.first
  6. => #<Item id: 1, user_id: 1, created_at: "2011-11-04 14:32:09", updated_at: "2011-11-04 14:32:09", ...>
  7. [4] pry(Item):2> cd first # Item.firstに移動する
  8. [5] pry(#<Item>):3> self # Item.first
  9. => #<Item id: 1, user_id: 1, created_at: "2011-11-04 14:32:09", updated_at: "2011-11-04 14:32:09", ... >
  10. [6] pry(#<Item>):3> user
  11. => #<User id: 1, url_name: "yaotti", ...>
  12. [7] pry(#<Item>):3> nesting # 移動した跡を見る
  13. Nesting status:
  14. --
  15. 0. main (Pry top level)
  16. 1. Item
  17. 2. #<Item>
  18. [8] pry(#<Item>):3> .ls # shellのコマンドを実行するときは先頭に.を付ける
  19. Capfile Guardfile Rakefile config doc public ...
  20. [9] pry(#<Item>):3> ^D # ctrl-dやexitを実行すると,1つ前のスコープに戻る
  21. [10] pry(Item):2>
Add Comment
Please, Sign In to add comment