views:

47

answers:

2

I am creating a plugin which involves a controller, model & views. while i can move these files from the vendor/plugin directory to app/controllers, models & views respectively.

now i can run my controller & model just by copying them in lib folder of vendor/plugins/plugin_name/lib and they are directly accessible, but my views are not initialized from there, so i need a technique which can make my views in vendor/plugins/plugin_name/lib/views accessible to rails framework without copying.

i am trying to add them to actionview, but not sure how to do that.

please guide me on this.

+1  A: 

There's ways you can add your plugin's views directory to the "search path" for ActionView, but the easiest way to handle all this is to just use something like the Rails Engines plugin to do all the hard work for you.

womble
thank-you for your reply, I read the article on rails engine, so once i have engine installed i just need to copy paste my plugin in required application(correct me if i am wrong). Also what if i want to pass my plugin in multiple applictaions, all of them need engine installed.
T.Raghavendra
I think that Rails 2.3 is supposed to have built-in support for something like this, btw
Mike Woodhouse
A: 

If you're looking to add models, views and controllers via a plugin, take a look at Desert: http://github.com/pivotal/desert. I'm not too keen on this approach, but Desert seems to work for people who like it.

nakajima
I appreciate your answer, but i just want to load views so i need something ActionView::Base.send or append views path directly , well if i point my controllers to access the views they work fine.
T.Raghavendra