# Putting it in a box

**URL:** <https://www.ruby-forum.com/t/putting-it-in-a-box/114089>\
**Category:** Rails\
**Created:** [September 7, 2007, 7:46pm UTC](https://www.ruby-forum.com/t/putting-it-in-a-box/114089 "2007-09-07T19:46:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ba9def/32.png) [@Mike\_P](https://www.ruby-forum.com/u/Mike_P)\
**Post date:** [September 7, 2007, 7:46pm UTC](https://www.ruby-forum.com/t/putting-it-in-a-box/114089/1 "2007-09-07T19:46:26Z")

</div>

My company has asked us to create a program that would be able to be  
customized then implemented many times. We have a core code base  
which includes the entire MVC structure. We would like to have that  
core separated from the customizations (kept in a box) but still give  
the flexibility to create your own entire set of MVC to work with our  
core. I know I can’t make plugins with Controllers and Models, but  
that’s kinda the idea we are looking for. I already know about  
engines, and that is perfect, but we are a little worried about the  
future. The last thing I need is to spend 12 months on a project that  
is dependent upon someone else’s plugin.

What are your thoughts? Is there another approach to enable this kind  
of plugin-type functionality with Controllers and Models?

Thanks!

---

<div class="post-metadata">

**Author:** ![Mike\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ba9def/32.png) [@Mike\_P](https://www.ruby-forum.com/u/Mike_P)\
**Post date:** [September 7, 2007, 8:12pm UTC](https://www.ruby-forum.com/t/putting-it-in-a-box/114089/2 "2007-09-07T20:12:54Z")

</div>

Mike P wrote:

> What are your thoughts? Is there another approach to enable this kind  
> of plugin-type functionality with Controllers and Models?

You can write plugins that generate controllers, models, views,  
migration scripts based on templates in your plugin. If your core is  
stable that could be an option.

Behavior can be written into plugins and then spread across a specifc  
controller or all controllers in the init.rb:

ActionController::Base.send(:include, MyPlugin::MyControllerBehavior)

---

<div class="post-metadata">

**Author:** ![Mike\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ba9def/32.png) [@Mike\_P](https://www.ruby-forum.com/u/Mike_P)\
**Post date:** [September 7, 2007, 8:18pm UTC](https://www.ruby-forum.com/t/putting-it-in-a-box/114089/3 "2007-09-07T20:18:31Z")

</div>

Gary W. wrote:

> You can write plugins that generate controllers, models, views,  
> migration scripts based on templates in your plugin. If your core is  
> stable that could be an option.

Could you point me in a direction for more information about this? It  
sounds like it’s exactly what I need.

---

<div class="post-metadata">

**Author:** ![Mike\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ba9def/32.png) [@Mike\_P](https://www.ruby-forum.com/u/Mike_P)\
**Post date:** [September 7, 2007, 8:43pm UTC](https://www.ruby-forum.com/t/putting-it-in-a-box/114089/4 "2007-09-07T20:43:46Z")

</div>

Mike P wrote:

> Could you point me in a direction for more information about this? It  
> sounds like it’s exactly what I need.

Here’s an example of one that does some generating:  
[http://code.google.com/p/rolerequirement/](http://code.google.com/p/rolerequirement/)

An article on generator (what the plugin is doing)  
[http://www.noobkit.com/rails-rails-generator](http://www.noobkit.com/rails-rails-generator)
