[8] pry(main)> app.class
=> ActionDispatch::Integration::Session
[9] pry(main)> app.users_path
=> "/users"
[10] pry(main)> app.root_url
=> "http://www.example.com/"
[11] pry(main)> app.new_user_session_path
=> "/user/sign_in"
[14] pry(main)> app.get '/users'
=> 302
[15] pry(main)> app.response.body.length
=> 101
app.get
app.post
app.put
app.delete
[13] pry(main)> helper.class
=> ActionView::Base
[17] pry(main)> "".methods.grep(/case/).sort
=> ["camelcase",
"casecmp",
"downcase",
"downcase!",
"swapcase",
"swapcase!",
"titlecase",
"upcase",
"upcase!"]
[18] pry(main)> all_users = User.all; nil
User Load (1.6ms) SELECT "users".* FROM "users"
=> nil
[22] pry(main)> y User.first
User Load (1.0ms) SELECT "users".* FROM "users" LIMIT 1
--- !ruby/ActiveRecord:User
attributes:
name: ghealey
encrypted_password: $2a$10$rhYT.gbYbOanyudJa19cluQ1XlFFh4ntC8IhH5p.xxa9ddrtSx4.O
created_at: 2010-11-26 05:51:01.32897
failed_attempts: "0"
updated_at: 2012-11-14 06:20:53.496916
last_sign_in_ip:
email: ghealey@example.com
=> nil
References:
http://37signals.com/svn/posts/3176-three-quick-rails-console-tips
http://samuelmullen.com/2012/07/getting-more-out-of-the-rails-console/
http://paulsturgess.co.uk/articles/39-debugging-tips-in-ruby-on-rails
http://www.therailworld.com/posts/35-Interacting-with-Controllers-via-the-app-object
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.