Engines at RailsConf
I gave my first presentation since Canada On Rails on Rails Engines at this year’s RailsConf, to cover the new support in Rails 2.3 for engines, including the problems you might encounter, how to handle them, and some advice about how to work effectively with this kind of re-use.
You can see the slides here, or on this slideshare:
Overall, it was quite an interesting conference from an Engines perspective, with lots of discussion about how this type of reuse will be supported, particularly in Rails 3. Yehuda Katz and Carl Lerche spoke about making the engines concept a proper, first-class citizen in Rails 3 via the concept of mountable apps. Exciting times!
In the meantime, there’s plenty we can do to improve support in Rails 2.3. In my presentation, I tried to highlight some of the existing issues and bugs, along with tickets so we can resolve them. Here’s a quick rundown.
Helper :all
When you call helper :all, this won’t load helpers from plugins. Ticket 1905 focusses on this, and it should be a simple fix.
Route precedence
While Rails 2.3 allows loading of routes from plugins, those routes get loaded first, overriding application routes. This seems like a bug, and while there’s a quick fix, I’d prefer to see more modular support for giving control of plugin routes directly to the developer; see Ticket 329 for my patch.
Migrations
Building a simple yet consistent way of handling migrations from multiple sources isn’t trivial, and while there are a number of possible partial and complete solutions, convincing others of which is best isn’t easy (particularly when some people don’t even believe that migrations should have a down aspect!). The discussion is happening on Ticket 2058, and if you can spend the time to really think through the options, your feedback is greatly appreciated.
I see migrations as being the big problem in mountable apps, and the ultimate solution might be a combination of code and policy (i.e. tables produced by engines should not be modified by the application), but only time will tell.