Engines/Slices Support in Edge Rails

Posted by Mobomo on November 28, 2008

As of commit 5fa0457 (on Thanksgiving Day 2008, nonetheless), Edge Rails is getting work done on having plugins as engines. An engine (as of now) is defined as a plugin that has an app/ folder, which includes controllers, helpers, models and views. There’s also support for plugin routes at this moment.

As of the commit mentioned above, Rails engines are not yet app slices. A slice, at least in my opinion, contains its own assets (public/) and its own migrations. In essence, a slice would have the same structure as a regular Rails app. Not sure what the core guys have planned, but also having support for these two would greatly improve on the value of writing engines.

This replaces the old components framework, and paves the way for a new way of writing re-usable Rails plugins. For example, the 15-minute blog screencast can easily be reworked to be an engine and re-used within multiple apps. You can also write engines for audio, video, maybe a wiki engine and so on.

We’ve been working on the problem of sharing code between multiple apps for quite some time now at Intridea, and I’ve also been talking about it a lot at RailsConf Europe with Michael Bleigh and at Bay Area Ruby meetups. The commits I’m noticing in core are great, hopefully soon there will be some more relevant work into officially namespacing the new code so that engines are distinct from plugins externally; storing them in vendor/engines or app/engines would also be good — a clean codebase is always something to look forward to.