Engine dependency - rails or railties ?

Apologies if the question is too naive.

When I create a new engine using rails plugin new <engine_name>, I can see a default dependency on “rails” in gemspec. Engines such as devise only have dependency on “railties” and not the whole of “rails”.

Why is the default dependency “rails” and not “railties” ?

  • Emil

My wild guess would be that a dependency on ‘rails’ will wind up depending on the whole set of framework gems (Active Record / Action Pack / etc) via the ‘rails’ gemspec whereas the ‘railties’ dependency is limited only to the actual engine infrastructure.

In Devise’s case ‘railties’ is likely chosen since you can use different ORMs and skip the generated controllers if you really want to. For a generated engine, you really need the whole ‘rails’ gem, since it puts a full Rails app in the test/dummy directory.

—Matt Jones