Forum: Ruby on Rails controllers, models and views in plugins

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A4a8fefcbd2cd6d2370609a5e2a3a389?d=identicon&s=25 Rob Merrell (Guest)
on 2006-03-13 08:21
(Received via mailing list)
Hello all,

Is it possible to package controllers, models and views in a plugin?
The
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
would
like to reuse in other projects.  I was thinking about making a
component
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
it
would be possible to do all of the display as a component and then write
a
plugin that just the models of my app can interact with to get the data,
but
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
within
plugins so I can package form widget as one.  I'd greatly appreciate it
if
somebody would point me in the right direction.

Thanks for the help,

Rob
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2006-03-13 08:24
(Received via mailing list)
A4a8fefcbd2cd6d2370609a5e2a3a389?d=identicon&s=25 Rob Merrell (Guest)
on 2006-03-13 16:09
(Received via mailing list)
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
engine
has app/controllers,models,etc... that can be used application wide, but
I'm
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?

Rob
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2006-03-13 17:02
(Received via mailing list)
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 Merrell <robholio@gmail.com> wrote:
> On 3/13/06, Pat Maddox <pergesu@gmail.com> wrote:
> > >
> it
> > > 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
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>


--
* J *
  ~
A4a8fefcbd2cd6d2370609a5e2a3a389?d=identicon&s=25 Rob Merrell (Guest)
on 2006-03-13 18:37
(Received via mailing list)
Thanks for the help James, I'll poke around the engines and see what I
can
come up with.

Rob
This topic is locked and can not be replied to.