Hi,

I am attempting to cache a page that varies depending on the URL that
you go to.  For example, http://mydomain.com/member_name goes to the
same action and controller as http://mydomain.com/other_member, but
the page is customized to the member.

I am currently accomplishing this with the following:

applications_controller.rb

caches_action :new, :cache_path => :new_cache_path.to_proc
....
private
  def new_cache_path
      params[:member_name]
  end

This works fine, but I run into issues when I try and sweep the cache
because im am not sure how I can pass the member_name parameter to the
sweeper.  The following is what I am using for a sweeper:

members_controller.rb

cache_sweeper :member_sweeper, :only => [ :update ]


class MemberSweeper < ActionController::Caching::Sweeper
  observe Member

  def after_save(product)
    expire_cache(product)
  end

  def after_destroy(product)
    expire_cache(product)
  end

  def expire_cache(product)
    expire_action 'member_name'
  end
end


The members name is being passed to the member controller via the
submitted form, I just need to know if it is possible to pass it to
the sweeper.

Thanks for your help!

Ryan




--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to