# Can't access my plugin views

**URL:** <https://www.ruby-forum.com/t/cant-access-my-plugin-views/183664>\
**Category:** Rails\
**Created:** [February 18, 2010, 2:09pm UTC](https://www.ruby-forum.com/t/cant-access-my-plugin-views/183664 "2010-02-18T14:09:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [February 18, 2010, 2:09pm UTC](https://www.ruby-forum.com/t/cant-access-my-plugin-views/183664/1 "2010-02-18T14:09:19Z")

</div>

I have created a plugin with a controller and views inside lib/app of  
the folder. I have added the controller’s folder to the LOAD\_PATH, but  
not the views. When using the plugin, the controller is loaded, but not  
the view of the action. It always searches on RAILS\_ROOT/app/views, not  
in my plugins folder. I have followed the Rails guides about how to  
create plugins, but it does not explain how to render views inside a  
plugin. Can anyone help? Should I put some code to user the plugin  
views?

I’ll appreciate any help.

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [February 18, 2010, 2:44pm UTC](https://www.ruby-forum.com/t/cant-access-my-plugin-views/183664/2 "2010-02-18T14:44:48Z")

</div>

On Feb 18, 1:09 pm, John S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have created a plugin with a controller and views inside lib/app of  
> the folder. I have added the controller’s folder to the LOAD\_PATH, but  
> not the views. When using the plugin, the controller is loaded, but not  
> the view of the action. It always searches on RAILS\_ROOT/app/views, not  
> in my plugins folder. I have followed the Rails guides about how to  
> create plugins, but it does not explain how to render views inside a  
> plugin. Can anyone help? Should I put some code to user the plugin  
> views?

What version of rails do you have ? In 2.3 the easiest way to do this  
is add a rails engine, in which case this should all just work,  
provided that the plugin has the correct directory structure (it needs  
to look a bit like an app ie controller in plugin/app/controllers,  
views in plugin/app/views  
Prior to that you have to do a bit more messing around -  
ActionController has a view\_paths setting which controls where it  
searches for stuff.

Fred

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [February 18, 2010, 6:14pm UTC](https://www.ruby-forum.com/t/cant-access-my-plugin-views/183664/3 "2010-02-18T18:14:31Z")

</div>

Frederick C. wrote:

> On Feb 18, 1:09ï¿½pm, John S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > I have created a plugin with a controller and views inside lib/app of  
> > the folder. I have added the controller’s folder to the LOAD\_PATH, but  
> > not the views. When using the plugin, the controller is loaded, but not  
> > the view of the action. It always searches on RAILS\_ROOT/app/views, not  
> > in my plugins folder. I have followed the Rails guides about how to  
> > create plugins, but it does not explain how to render views inside a  
> > plugin. Can anyone help? Should I put some code to user the plugin  
> > views?
> 
> What version of rails do you have ? In 2.3 the easiest way to do this  
> is add a rails engine, in which case this should all just work,  
> provided that the plugin has the correct directory structure (it needs  
> to look a bit like an app ie controller in plugin/app/controllers,  
> views in plugin/app/views  
> Prior to that you have to do a bit more messing around -  
> ActionController has a view\_paths setting which controls where it  
> searches for stuff.
> 
> Fred

Ok. I’ll look for rails engines. Maybe with Rails 3.0 it’s different  
too.
