# How to pack models, controllers into a Plugin

**URL:** <https://www.ruby-forum.com/t/how-to-pack-models-controllers-into-a-plugin/140354>\
**Category:** Rails\
**Created:** [June 13, 2008, 6:54am UTC](https://www.ruby-forum.com/t/how-to-pack-models-controllers-into-a-plugin/140354 "2008-06-13T06:54:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 13, 2008, 6:54am UTC](https://www.ruby-forum.com/t/how-to-pack-models-controllers-into-a-plugin/140354/1 "2008-06-13T06:54:01Z")

</div>

We have been using rails to build a application platform for years.  
Because some of projects are completely different, we have to branch  
our trunk and make changes in branch.  
But among trunk and branches, they do have similar models and  
controllers, the platform core.  
So, we are thinking about extracting these core into a plugin, which  
may contains models, controllers and maybe views (but I would like to  
put views in specific project’s /app/views, because of the layout are  
in project).  
And if needed, we could override models or controllers by creating a  
same class in /app/models or /app/controllers.

Most of the article in Google are talking about how to extend model in  
plugin. Is that a good idea to pack part of your project into a  
plugin??

Right now, I have problem like loading order, inherence issue. Has  
anyone done works like these?

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 13, 2008, 9:50am UTC](https://www.ruby-forum.com/t/how-to-pack-models-controllers-into-a-plugin/140354/2 "2008-06-13T09:50:21Z")

</div>

On Jun 12, 2008, at 9:53 PM, removed\_email\_address@domain.invalid wrote:

> Is that a good idea to pack part of your project into a  
> plugin??

It makes a lot of sense to me. Easier to share among projects, and  
you can manage versioning of the plugin independently of the  
projects. I’ve already started to move the pieces I know I’ll be  
reusing into plugins.

For refc material, I found The Rails Way useful, but the peepcode PDF  
was much more detailed, so get that for sure. Then download a few of  
the well known plugins to compare as examples too.

[https://peepcode.com/products/rails-2-plugin-patterns](https://peepcode.com/products/rails-2-plugin-patterns)

– gw
