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?

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

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