Partials and config.load_paths

Is it possible to define a sub directory in the views folder to put
partials? In my config.load_paths in the environment.rb I’ve added an
entry to the effect of “config.load_paths += %W( #{RAILS_ROOT}/app/
views/my_item/my_partials )” where I’ve placed partials but they can’t
be found when referencing them from the views/my_item.rhtml file. Am I
missing something? (it works fine when I place the partials in the
same directory as my_item.rhtml file)

config.load_paths is for libs i think

if you want to render a partial in a special place, just give it the
path:

render :partial => “/my_path/my_partial”

On 7 May 2008, at 14:26, MaddyTheGoose wrote:

Is it possible to define a sub directory in the views folder to put
partials? In my config.load_paths in the environment.rb I’ve added an
entry to the effect of “config.load_paths += %W( #{RAILS_ROOT}/app/
views/my_item/my_partials )” where I’ve placed partials but they can’t
be found when referencing them from the views/my_item.rhtml file. Am I
missing something? (it works fine when I place the partials in the
same directory as my_item.rhtml file)

config.load_paths is for something entirely different. If you render
the partial foo/bar then it will render the partial app/views/foo/
_bar.html.erb (or whatever file type it happens to be)

Fred

I figured I must be off track with this. Thanks for pointing me in the
right direction.

On May 7, 9:51 am, Thorsten M. [email protected]

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