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 <name> 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
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 Nicjac wrote:> 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 > <name> 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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
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. On 9/1/06, Bharat <bharata-k+Hz54J8xG4AvxtiuMwx3w@public.gmane.org> wrote:> > > 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 > > > > Nicjac wrote: > > 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 > > <name> 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 > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---