Debugging Routes

ruby script/console

To see how an external request would map to your internal path:

>>rs = ActionController::Routing::Routes

Sample:

>>rs.recognize_path "/controller/action/id", :method => :get

To reload routes.rb if you made changes to it: ActionController::Routing::Routes.reload

—-

To generate a path use generate method:

>>rs.generate :controller => "controllername", :action => "actionname", :id => 123, :extra => "extrastuff"
=> "/controllername/actionname/123?extra=extrastuff"
VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Facebook Twitter Email

Leave a Reply