Posted By

cczona on 03/13/09


Tagged

debug rails console request


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

webstic


Call ActionController methods from the Rails console


 / Published in: Rails
 

The 'request' and 'response' objects are chock full of useful info. But console can't usually access them. Here's how: start the server with the -u option, insert a breakpoint where you would like to have access to the controllers/helpers/etc. When finished, just type 'cont' to continue execution

  1. # terminal
  2. script/server -u
  3.  
  4. # /some/view.erb
  5. <% debugger %>
  6.  
  7. # open the url associated with that view, and switch over to the terminal to play with ActionController methods and objects
  8. (rdb:2) request

Report this snippet  

You need to login to post a comment.