# How to create an app plugin?

**URL:** <https://discuss.rubyonrails.org/t/how-to-create-an-app-plugin/11674>\
**Category:** rubyonrails-talk\
**Created:** [April 13, 2007, 10:18pm UTC](https://discuss.rubyonrails.org/t/how-to-create-an-app-plugin/11674 "2007-04-13T22:18:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephane](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@Stephane](https://discuss.rubyonrails.org/u/Stephane)\
**Post date:** [April 13, 2007, 10:18pm UTC](https://discuss.rubyonrails.org/t/how-to-create-an-app-plugin/11674/1 "2007-04-13T22:18:01Z")

</div>

Hi all,

I would like to create a 'piece' of application, a poll system, and want to make it as a plugin.

I found many information about plugins, most about mixin and extending core, but not so much for making plugin with controllers and views.

First, Do I think the wrong way with plugin ?

Then I found the following on techno weenie:

for your model :

&nbsp;&nbsp;&nbsp;&nbsp;models\_path = File.join(directory, 'app', 'models') &nbsp;&nbsp;&nbsp;&nbsp;$LOAD\_PATH \<\< models\_path &nbsp;&nbsp;&nbsp;&nbsp;Dependencies.load\_paths \<\< models\_path

for the controllers it's quite the same:

&nbsp;&nbsp;&nbsp;&nbsp;controller\_path = File.join(directory, 'app', 'controllers') &nbsp;&nbsp;&nbsp;&nbsp;$LOAD\_PATH \<\< controller\_path &nbsp;&nbsp;&nbsp;&nbsp;Dependencies.load\_paths \<\< controller\_path &nbsp;&nbsp;&nbsp;&nbsp;config.controller\_paths \<\< controller\_path

And finally to include views, you should integrate in your controller:

&nbsp;&nbsp;&nbsp;&nbsp;self.template\_root = File.join(File.dirname(\_\_FILE\_\_), '..', 'views')

Is it a good practise ? Is it the good way to share a piece of application?

And other questions come to my mind:

&nbsp;&nbsp;&nbsp;&nbsp;\* How standardize the way of communicate between application and plugin ? &nbsp;&nbsp;&nbsp;&nbsp;\* In the same topic, I have 2 parts in the plugin, one for admin and one for front user, How should I do to easily provide a plugin knowing every application have a different way to authorize or authenticate users?

Please feel free to share any knowledge on these subjects 🙂

---

<div class="post-metadata">

**Author:** ![Benjamin\_Curtis1](https://avatars.discourse-cdn.com/v4/letter/b/9de0a6/32.png) [@Benjamin\_Curtis1](https://discuss.rubyonrails.org/u/Benjamin_Curtis1)\
**Post date:** [April 13, 2007, 10:33pm UTC](https://discuss.rubyonrails.org/t/how-to-create-an-app-plugin/11674/2 "2007-04-13T22:33:16Z")

</div>

Engines ([http://rails-engines.org/](http://rails-engines.org/)) are typically the way to go to  
share complete MVC slices among applications.
