Partials, application_helper and layout... aargh!

Hello everyone,
I am relatively new to RoR and I am trying to implement a simple
content management system. I know I am reinventing the wheel but you
can’t really learn a language using others’ plugins…

So anyway, I have a problem. I am not sure if it’s a design mistake or
just that I don’t get something. I have a layout for my whole website
(except the admin part), which is shared by all the controllers (using
the layout “blabla” declaration at the beginning of each controller.)

In this layout I am using an application_helper I designed to show
special text if the user is logged or not (something like : Logged as
or Not logged in (login in?)). This helper uses partials to show
the right view if logged or not.

The problem is that RoR is looking for the partials in the controller
view directory, but as I am using it globaly for the whole site, I do
not want to put the partials in every controller view directories !

Anyone has a suggestion ?

Thanks !

Nicolas Jaccard

It might be better to keep it in the global template itself. If you are
not reusing the partial in a limited set of controllers, just put it in
the global(application) template itself.

Bharat
http://blog.publishedperspectives.com

When you render :partial you can specify the path to the partial.

So, if your partial exists in /foo/_userinfo.rhtml you’d use

<%=render :partial =>"/foo/userinfo" %>

The common practice is to create a folder called

/app/views/shared/

and put your shared partials there.