Last Updated: June 11, 2021
·
1.967K
· kb

Interactive Routes via Rails Console

It's helpful at times to drop into the rails console to see how your routes are generating. Rails 3 makes this really easy by exposing the app object in console. From there you can simply start calling named routes off of the app object...

app.root_url
=> "http://www.example.com/"

app.posts_url
=> "http://www.example.com/posts"

app.post_url(1)
=> "http://www.example.com/posts/1"

1 Response
Add your response

That's cool! For me, I've been using sextant to access rake routes from the browser instantly. https://github.com/schneems/sextant

over 1 year ago ·