flukus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Feb-18 11:35 UTC
partials with action methods?
I have a pretty standard partial for my sidebar that I want to display the login form etc if the user is not logged in and if they are then display the relevant links. As far as I can tell, calling render :partial does not trigger methods in the controller class. So how do I get application data into the partial. The partial is invoked by the layout, which doesn''t have access to controller functions so they only way I can see around this is to create the required objects in a befor_filter. Is there a more elegant way to do this? without render_component? --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
> The partial is invoked by the layout, which doesn''t have access to > controller functions so they only way I can see around this is to > create the required objects in a befor_filter.Yeah - use a before filter to load the data you need for the sidebar, then use a helper or partial to display it. Steve --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---