Dirk Dot Net

Creator of useful things. Based in Chiang Mai, Northern Thailand.

Accessing Routes in script/console

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


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…