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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060313/047f2a9c/attachment.html
Check out http://www.rails-engines.org/wiki/pages/Components+vs.+Plugins+vs.+Engines for some info. Pat On 3/13/06, Rob Merrell <robholio@gmail.com> wrote:> 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 > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
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 On 3/13/06, Pat Maddox <pergesu@gmail.com> wrote:> > Check out > http://www.rails-engines.org/wiki/pages/Components+vs.+Plugins+vs.+Engines > for some info. > > Pat > > > > On 3/13/06, Rob Merrell <robholio@gmail.com> wrote: > > 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 > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- "Do not meddle in the affairs of dragons, for you are crunchy and good with ketchup." -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060313/db0ca81a/attachment.html
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:> 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 > > > On 3/13/06, Pat Maddox <pergesu@gmail.com> wrote: > > Check out > http://www.rails-engines.org/wiki/pages/Components+vs.+Plugins+vs.+Engines > > for some info. > > > > Pat > > > > > > > > On 3/13/06, Rob Merrell < robholio@gmail.com> wrote: > > > 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 > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > -- > "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 * ~
Thanks for the help James, I''ll poke around the engines and see what I can come up with. Rob On 3/13/06, James Adam <james.adam@gmail.com> wrote:> > 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: > > 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 > > > > > > On 3/13/06, Pat Maddox <pergesu@gmail.com> wrote: > > > Check out > > > http://www.rails-engines.org/wiki/pages/Components+vs.+Plugins+vs.+Engines > > > for some info. > > > > > > Pat > > > > > > > > > > > > On 3/13/06, Rob Merrell < robholio@gmail.com> wrote: > > > > 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 > > > > > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails@lists.rubyonrails.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > -- > > "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 * > ~ > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- "Do not meddle in the affairs of dragons, for you are crunchy and good with ketchup." -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060313/c70bd779/attachment.html