[Rails] Re: Cache output issue
On Sep 16, 6:32 pm, badnaam <asitkmis...@gmail.com> wrote:
> I am using memcached.. and have the folllowing in my partial.
>
> <%CACHE.fetch 'all_categories' do %>
> <ul>
> Category.all.each do |c|
> <li><%= c.name %> </li>
> end
> </ul>
> <%end %>
>
> When I check in the irb console the "all_categories" key does get
> populated.
> So..CACHE.fetch 'all_categories' in irb does output the expected html
> list.
>
> But nothing gets outputted in my view.
>
> I am guessing this is some sort of syntax error, what am I doing wrong?
In the case where the data is already in the cache the block is not
yielded to, so nothing will be output. You could try changing it to a <
%= but I'm not sure that mixes well with yielding to a block or the
case when it is generated fresh data. Why not use cache_fragment ?
Fred
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home