Engines vs plugins

hi engineers…

we’re just planning whether to use engines or build something around
plugins, interested to know what success others are having.

“engines” seem to allow most of what i need, but i have some concerns.
they depend lot of rails internals, and it seems they aren’t the safest
way to go - every time rails changes, all engines break. if the core
stopped maintaining engines, i doubt we’d be able to go in and keep
things working…

when components come back as a plug (rails2) will this conflict with
the work on engines?

------ reusable code in rails

Like many other companies I’m sure, we have a bunch of rails code for
building social networks. and we’re doing lots of projects that are very

i was wondering what rails options have been succesful for other
people for code re-use across projects.

my understanding is that plugins’ approach to anything with views is
to use generators.
you cant actually have view/controller code in the plugin?

the problem with generators is that then you cant re-use any
modifications to the generated code - theyre basically one-way. but
this maybe OK, if a lot of the actual code is still in the plugin.

  • concrete example: forum
    a good specific thing we need to do: a forum. if we move this into a

  • migrations
    there arent easy way to share migrations with the main app and an also
    evolving plugin. this could possibly be solved in the plug-in
    installer having its own mini-migrations.
    (engines solves this)

  • getting added code back into plugin
    but, lets say we add a function to the forum. eg we want to show the
    “status” of any poster.
    eg are they a level1, or level5 person.
    this is basically a modify of the view, plus reading some data from
    the user model: user.status
    not much controller code.

if we modify the forum view after the code was generated, then no code
goes back into the plugin for re-use/sharing. a generator is basically

  • view helpers?
    since plugins support -view helpers- we could rewrite the forum views
    all as helper methods. these could then maybe be passed parameters? eg
    would be in the view for the app, but the actual rhtml would be inside
    the helper?

  • installing partials
    another thing some people seem to do is have the installer copy some
    partials into the main app.
    this is just as set in stone as generators really. eg:

  • can a plugin include a controller?
    i guess it could include a module that the controller in the app could

  • non abstract plugins
    basically for abstract functions (like a swf renderer, or AR/ acts_as
    extensions) the plugin approach works well. but not sure how much it
    will save us on these view-oriented functions.
    it may end up being a lot of work to make the plugin, and then its
    basically just a fancy way to cut and paste the code. how much code
    will actually be in the plugin, vs. what is generated?

i think this is a problem for rails. now components are in limbo,
there isnt an obvious way to reuse/subclass view-related

given above caveats about engines, not sure what is the best approach.

Any thoughts appreciated.