[LRUG] Rails 3 engines dir layout

Priit Tamboom priit at mx.ee
Tue Aug 3 02:19:57 PDT 2010


Morning!

I'm currently porting a Rails 2 project over to Rails 3 and also
extracting some common engine related stuff into "engineered" gem [1].

Currently engine dir layout are following rails default way as
app/controllers/#{my_engine_name}/example_controller.rb. However more
I develop new engines more I feel I should probably investigate into
some alternative way to namespace in order to keep engine dir layout a
bit more flat.

For example, when some engine has got an admin interface, then it goes
even more deep as
app/controllers/#{my_engine_name}/admin/example_controller.rb

Therefore what if engine dir layout itself does not have namespace,
but I will provide it other ways instead, so all engine apps will have
automatically namespaced when included into master app.

As we know Rails 3 paths are not hardcoded [2], so paths can be more
flexible if really needed. However I'm not yet sure is it worth the
trouble to implement such a feature into "engineered" gem. It might
create more trouble than current situation with deeper layouts.

Have you stumbled into similar idea/situation or perhaps I just miss something.

Cheers,
Priit

[1] http://github.com/priit/engineered
[2] http://github.com/rails/rails/blob/master/railties/lib/rails/engine/configuration.rb



More information about the Chat mailing list