Action Cache and content_for

97 views
Skip to first unread message

Sanchit Garg

unread,
Apr 18, 2011, 8:24:40 AM4/18/11
to rubyonra...@googlegroups.com
I am facing some problem with action cache and content_for. Once I set an action for action cache, it does not run content_for code mentioned in the view even first time. I understand that once the cache is created, it will not be run anymore. However the issue is that it is not ran even first time. Here is the snipped of the code:

Controller:
caches_action :aboutus, :layout => false

Views:
<%= title "about us" %>

application_helper.rb:
 def title(page_title)
    content_for (:title) { page_title }
  end

Layout:
<title><%= yield(:title)  %></title>

I cleared my cache (rm -rf tmp/cache/*) and reloaded the browser, but still the title is not set. Any idea?

Thanks
Sanchit
Reply all
Reply to author
Forward
0 new messages