Calling a controller from the Rails console

Fire up your console:

rails c


app.get ‘/posts/1’

response = app.response

response.body # if you need the HTML body

response.cookies # if you want a hash of the cookies

Plenty more here:

and here:

However, if you want to do some serious debugging you’ll probably want to use pry. See an earlier post.

Leave a Reply

Your email address will not be published. Required fields are marked *