Can't access my plugin views

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.

On Feb 18, 1:09 pm, John S. [email protected] 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

Frederick C. wrote:

On Feb 18, 1:09�pm, John S. [email protected] 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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs