Dynamic content in layouts

My normal dynamic content is added with the yield command, but now I
would like to add a partial to my layout as well. The partial will
generate some links depending on which layout is this. It works fine at
first but when I switch between layouts, all of the links are there. I
think Rails caches thems. How can I disable this feature? Or work my way
around it?

Upping this. I’d really appreciate some help. :confused:

On 10/2/06, RoR newbie [email protected] wrote:

My normal dynamic content is added with the yield command, but now I
would like to add a partial to my layout as well. The partial will
generate some links depending on which layout is this. It works fine at
first but when I switch between layouts, all of the links are there. I
think Rails caches thems. How can I disable this feature? Or work my way
around it?

I’m not sure that I understand your question, or rather how your having
this
issue. Is your partial called from within your layouts? or inside
another
view?

There is nothing stopping you from generating a partial in a layout.
Just
include the partial in your layout like any other partial

<%= render :partial => ‘my_partial’ :object => some_object -%>

This should not be cached unless you have requested that it be cached.

There is specific information regarding caching here
http://api.rubyonrails.org/classes/ActionController/Caching.html

Sorry I couldn’t be more help. Maybe if you could give some more
information with your specific case…

hi
rails doesn t cache layouts, your problem is likely to be a coding error

also for your case i think it is better to have more than 1 layout (ie
one
layout for a specific set of links)


Heri R.
http://sprinj.com

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