Rails Engines, what are they? What do they do? But most importantly: how do they do it?
Rails 2.3 brings us much of the same functionality as the Rails Engines plugin. Learn how to embed one application into another in this episode.
Engines allow us to use one application in another in the form of a plugin. As the screencast shows, you can integrate the
app folder of a Rails application in the plugin of another one. All models, controllers and views are available. If you still need custom functionality, you can add them in your applications ‘own’
app folder by redefining the model, controller or view. The same goes for routes; if you have
routes.rb in your plugin dir, it is loaded as well.
And i18n, how about that? You would expect
config/locals/*.yml to work just as nicely as the
app dir and
routes.rb. But it doesn’t.
Luckily, it’s not that hard to solve:
environment.rb, you add
Sign up for our newsletter
Who’s got the mic?
Architecture & Design
Koen Van Der Auwera
Bob Van Landuyt
Nathan de Witte