Testing Named Routes in the Rails Console

I finally found out how to do this, from the Rails Routing shortcut by David Black. In the Rails console, do this:

include ActionController::UrlWriter
default_url_options[:host] = 'whatever'

Then you can call your named route methods directly from the console.


This entry was posted on Tuesday, January 8th, 2008 at 1:58 pm and is filed under Programming, Ruby.You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

I’ve always just worked around this by trying it out in the templates. Should keep looking things up on google. I learn much more that way. Anyway, thought the rest of you should know also.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s