26 Nov 2008

Rails gets some engines love

No sooner is Rails 2.2 out the door than edge Rails gets exciting again!

A tasty little commit hints at some major changes to the way Rails handles plugins. Finally, the awesome features of the engines plugin (lovingly crafted by James Adams) will be creeping into core.

I’m not one to speculate what brought about the change in heart, I’m just glad Rails is finally drinking the engines Kool-Aid!

Engines? Wha?

As it says in the README: “The engines plugin enhances Rails’ own plugin framework, making it simple to share controllers, helpers, models, public, assets, routes and migrations in plugins”.

In a nutshell, you get to create slices of apps as plugins which makes it a piece of cake to to share common functionality between multiple applications. In my case, I’ve been able to put together several e-commerce websites with practically all the core functionality provided by a set of plugins. The beauty of it is, you can easily override views, actions, etc, in your app to make each site it’s own. And when you fix a bug, or add a new feature, all the sites can benefit!

What comes next?

It’s still early days and it’s not yet clear just how much of this is getting rolled into Rails, but James has hinted that much will make it across, including migrations, routes and asset management.

In the mean time, if you want to see what all the fuss is about, check out the engines plugin which, thanks to the hard work of everyone involved, now runs happily on Rails 2.2!

Update

The commits are coming thick and fast now. I’m certainly looking forward to road testing these new feature as they take shape.