Loading dummy app routes from a mountable engine

-

I've been building a Rails 3.2 engine, and when I created it, chose the 'mountable' option, rather than the full option.

One issue that I faced was the inability to see the routes generated by my engine, as seen by the dummy app. Asking on #RubyOnRails led to many people thinking this was odd behaviour, and offered no solution.

Digging into the forem code, I discovered this in the Gemfile:

APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)

if File.exists?(APP_RAKEFILE)
  load 'rails/tasks/engine.rake'
end

Adding this to my engine's Rakefile fixed the inability to run rake against the app. I could now run rake app:routes to see the dummy app routing table.

Next stop: Rails source.

Turns out that if you choose the 'mountable' option rather than the 'full' one when creating the engine, you miss out on this option, as seen in the rails code.

I'll investigate why this shouldn't be loaded on a mountable app, and post back later.