# How to create a plugin

**URL:** <https://www.ruby-forum.com/t/how-to-create-a-plugin/91915>\
**Category:** Rails\
**Created:** [April 13, 2007, 12:01pm UTC](https://www.ruby-forum.com/t/how-to-create-a-plugin/91915 "2007-04-13T12:01:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dfb087/32.png) [@Stephane](https://www.ruby-forum.com/u/Stephane)\
**Post date:** [April 13, 2007, 12:01pm UTC](https://www.ruby-forum.com/t/how-to-create-a-plugin/91915/1 "2007-04-13T12:01:34Z")

</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 :

```
models_path = File.join(directory, 'app', 'models')
$LOAD_PATH << models_path
Dependencies.load_paths << models_path

```

for the controllers itâ€™s quite the same:

```
controller_path = File.join(directory, 'app', 'controllers')
$LOAD_PATH << controller_path
Dependencies.load_paths << controller_path
config.controller_paths << controller_path

```

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

```
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:

```
* How standardize the way of communicate between application and

```

plugin ?  
\* 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 🙂

–  
Stephane  
[http://www.rubynaut.net](http://www.rubynaut.net)

---

<div class="post-metadata">

**Author:** ![Stephane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dfb087/32.png) [@Stephane](https://www.ruby-forum.com/u/Stephane)\
**Post date:** [April 13, 2007, 1:25pm UTC](https://www.ruby-forum.com/t/how-to-create-a-plugin/91915/2 "2007-04-13T13:25:27Z")

</div>

Here is a nice tutorial demonstrating how to create a plugin.

[http://wiki.rubyonrails.com/rails/pages/HowToWriteAnActsAsChickenPlugin](http://wiki.rubyonrails.com/rails/pages/HowToWriteAnActsAsChickenPlugin)  
Please refer this,…

Regards,  
Jazzzzzzzzzzzzzy…

---

<div class="post-metadata">

**Author:** ![Stephane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dfb087/32.png) [@Stephane](https://www.ruby-forum.com/u/Stephane)\
**Post date:** [April 13, 2007, 1:29pm UTC](https://www.ruby-forum.com/t/how-to-create-a-plugin/91915/3 "2007-04-13T13:29:58Z")

</div>

Thanks for the link. I have found a lot information about how to create  
plugin to extend activerecord but for this plugin I need to provide also  
controllers and views 😉

---

<div class="post-metadata">

**Author:** ![Stephane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dfb087/32.png) [@Stephane](https://www.ruby-forum.com/u/Stephane)\
**Post date:** [April 14, 2007, 12:19am UTC](https://www.ruby-forum.com/t/how-to-create-a-plugin/91915/4 "2007-04-14T00:19:27Z")

</div>

So much answers, maybe I m on the wrong way 😛

---

<div class="post-metadata">

**Author:** ![Stephane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dfb087/32.png) [@Stephane](https://www.ruby-forum.com/u/Stephane)\
**Post date:** [April 14, 2007, 1:05pm UTC](https://www.ruby-forum.com/t/how-to-create-a-plugin/91915/5 "2007-04-14T13:05:15Z")

</div>

Have a look here… [http://rails-engines.org/](http://rails-engines.org/)

Wes Ratcliff

On Apr 13, 5:19 pm, “Stephane B.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Stephane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dfb087/32.png) [@Stephane](https://www.ruby-forum.com/u/Stephane)\
**Post date:** [April 14, 2007, 1:38pm UTC](https://www.ruby-forum.com/t/how-to-create-a-plugin/91915/6 "2007-04-14T13:38:48Z")

</div>

Thanks, finally, I think there are 2 solutions:

- rails-engines
- appable plugin

Wes wrote:

> Have a look here… [http://rails-engines.org/](http://rails-engines.org/)
> 
> Wes Ratcliff
