I'm writing a mountable Rails 3 Engine, and I am combining my engine's routes with the host app's. However, the host app's routes are taking precedence over my engine's routes. Is there a way I can override the host app's routes (specifically the root route)?
Here's my engine's routes in my_enging/config/routes.rb
:
MyEngine::Engine.routes.draw do
root :to => "home#index"
end
# Mount engine routes to host application
Rails.application.routes.draw do
mount MyEngine::Engine, :at => "/"
end
And here's the results of rake routes
, with the host's root sitting at the top:
root / welcome#index
my_engine / MyEngine::Engine
root / home#index
Spree is one gem that does this, but I haven't been able to find how they're implementation this.