Controllers, models and views in plugins


Hello all,

Is it possible to package controllers, models and views in a plugin?
tutorials for plugins seem rather sparse at the moment…

I’ve written a form “widget” that I’ve been using as a partial that I
like to reuse in other projects. I was thinking about making a
out of it, but I need to be able to access some of the form data that it
saves in my application’s models, so that wouldn’t work. I suppose that
would be possible to do all of the display as a component and then write
plugin that just the models of my app can interact with to get the data,
this doesn’t seem like the most elegant of solutions.

So to sum it up I’m hoping that it is possible for mvc’s to be used
plugins so I can package form widget as one. I’d greatly appreciate it
somebody would point me in the right direction.

Thanks for the help,



Check out
for some info.



Thanks for the link Pat. I read through it and it seems like what I
need is
a cross between a component and a plugin. I’ve noticed that the user
has app/controllers,models,etc… that can be used application wide, but
not sure if these MVC’s are something specific to engines or if a normal
plugin can have the app/controllers, etc. Anybody have any ideas if the
same can be done with plugins?



In a nutshell, the engines plugin enhances the plugin system to
provide the kind of functionality that you seem to want, and the
engines plugin only exists because it’s not possible to achieve this
with the vanilla Rails plugin mechanism.

An “engine” really IS a plugin, with a few minor differences (that
most significant being the replacement of init.rb with init_engine.rb)
that enable loading views, controllers and models (and other stuff:
public assets, migrations, tests) from within them. That’s basically
all it’s for.

  • james

On 3/13/06, Rob M. removed_email_address@domain.invalid wrote:

On 3/13/06, Pat M. removed_email_address@domain.invalid wrote:


somebody would point me in the right direction.

“Do not meddle in the affairs of dragons, for you are crunchy and good
with ketchup.”

Rails mailing list

  • J *


Thanks for the help James, I’ll poke around the engines and see what I
come up with.