Is it possible to create whole rails applications under a common namespace?
Lets assume that my company name is Acme, Inc. and I have the following rails projects: Blog, Store, WebService.
By default, if I do something like rails new blog
the generated applications will be like:
module Blog
class Application < Rails::Application
module Store
class Application < Rails::Application
module WebService
class Application < Rails::Application
where every project/application is self contained and there is no implicit reference to the company. Ideally I would like to have all this applications under the company namespace, so we can refer to them as:
AcmeInc::Blog::Application
AcmeInc::Blog::Entities::Article
AcmeInc::Store::Application
AcmeInc::Store::Entities::Product
AcmeInc::Store::Entities::Order
AcmeInc::Store::Entities::Customer
etc...
Is this possible? Recommended?
Using: ruby-2.0.0-p451, rails 3.2.17
Update
Snapshot of generated files and project structure after doing rails new acme/blog as suggested:
The correct way to do this is with engines. Each engine is like a standalone app, with it's own routes, test suite, etc, but you can have some common infrastructure like rake tasks, etc.
http://guides.rubyonrails.org/engines.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With