creating a rails plugin

What do you mean by "i need to add MVC"?

What do you want your plugin to do?

I have a working rails application. I would like to move the user
management part of the application into a plugin structure (make a
plugin for user management). So that I don't have to repeat the same for
another application with similar user management requirements.

So I am trying to make a plugin from the Model, View, and Controller of
this user management part of my application.

Hi Amita,

Not really sure if you still need it, but a good source of ideas is
the Translate plugin ( ). They do exactly
what you're looking for and it works like a charm, i bet you can get
some ideas to get your code working.

Thanks Maurício for sharing the resources..

I have already made some progress, but now stuck with another problem
related to REST and Ajax.updater (to automatically populate timezones
depending on U.S.A. state selected).

And what`s the problem?

Doing it is quite straightforward after you have the list of timezones
based on states :slight_smile:

What you`re looking for is a way to configure your plugin, the
simplest way to do it is just let the user reopen your classes and
change what is need in a initialization file. You could also create a
configuration file and have your plugin to load it and configure the
pieces that are "configurable", like the model that`s going to be used
(in your case, the photos our albuns).

Also, model plugins are usually small and very specific in what they
do, your plugin seems to do a lot and this isn't really common when
dealing with plugins. Some plugins, like restful_auth, don't even use
models, but contain modules that are included in your models, this is
better `cos it's easier for someone using your plugin to override your

You should definitely take a look at the Rails Plugins patterns PDF ->

Thanks for the link.. I am going through the guide.
However, I am still wondering how can I include associations (has_many
and belongs_to methods) in my plugin. Because I do not know what will be
the model/table name used by user to associate my plugin's model to..

e.g.: for one application it could be user- :has_many photos or for
another application- user :has_many songs .


Maurício Linhares wrote:

Usually, plugins do it by using polymorphic associations, so they
don't need to know in advance the real class that's going to be