Alex Rivera | Logout

Recognize routes in rails console Session

Asked 2010-05-06T02:31:00.100
60

Say I have a router helper that I want more info on, like blogs_path, how do I find out the map statements behind that in console.

I tried generate and recognize and I got unrecognized method error, even after I did require 'config/routes.rb'

Edit
Report

1 Answer

62

In the console of a Rails 3.2 app:

# include routing and URL helpers
include ActionDispatch::Routing
include Rails.application.routes.url_helpers

# use routes normally
users_path #=> "/users"
answered 2012-07-13T03:25:24.597

Your Answer