开发者

RoR fragement caching based on id

Is there a way to cache a fragment based only on an id and a part?

For example, <% cache(:id => session[:user], :part => 'test') do %>

The code doesn't seem to work though. It still caches based on the action that called it.

Edit:

The problem that I am having is that I cannot expire a fragment in an ajax request(I am refreshing the page as well with page.reload). I think the problem is the action I'm trying to expire is a member of a resource.

Here's my routes code:

ma开发者_开发技巧p.resources :profiles, :as => 'profile', :only => [:show, :edit, :update], :member => {
  :home => :get
  } do |profile|

Here's the expire fragment:

expire_fragment(:controller => 'profiles', :action => 'home', :part => 'test')

Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜