I am writing a mounted Rails 3 Engine, and I combine my routes with the host application. However, host application routes take precedence over my routes. Is there a way to redefine host application routes (in particular, the root route)?
Here my engine moves to my_enging/config/routes.rb:
MyEngine::Engine.routes.draw do
root :to => "home#index"
end
Rails.application.routes.draw do
mount MyEngine::Engine, :at => "/"
end
And here are the results rake routes, with the host root at the top:
root / welcome#index
my_engine / MyEngine::Engine
root / home#index
Spree is the one stone that does this, but I could not find how they are implemented.
source
share