Accessing Routes in script/console

Ruby on Rails Add comments

In script console the app object exposes ActionController::Integration::Session which contains all your routes, so you can go:

app.widgets_path

etc. No need  (comment) to include ActionController::UrlWriter

But to use your routes in the model, you wouldn’t use an instance of ActionController::Integration::Session, no, don’t, it’s a terrible hack, dirty and immoral, bordering on evil, MVC abused and perverted. Then again, you never know…

 

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in