Index: lib/acts_as_cached/fragment_cache.rb =================================================================== --- lib/acts_as_cached/fragment_cache.rb (revision 2054) +++ lib/acts_as_cached/fragment_cache.rb (working copy) @@ -30,6 +30,7 @@ ::ActionController::Caching::Actions::ActionCacheFilter.class_eval do # convert all actions into a hash keyed by action named, with a value of a ttl hash (to match other cache APIs) def initialize(*actions, &block) + @options = actions.extract_options! @actions = actions.inject({}) do |hsh, action| returning(hsh) do action.is_a?(Hash) ? hsh.update(action) : hsh[action] = { :ttl => nil } @@ -40,7 +41,7 @@ # override to skip caching/rendering on evaluated if option def before(controller) return unless @actions.include?(controller.action_name.intern) - action_cache_path = ActionController::Caching::Actions::ActionCachePath.new(controller) + action_cache_path = ActionController::Caching::Actions::ActionCachePath.new(controller, path_options_for(controller, @options)) # should probably be like ActiveRecord::Validations.evaluate_condition. color me lazy. if conditional = @actions[controller.action_name.intern][:if] @@ -54,13 +55,15 @@ set_content_type!(action_cache_path) controller.send(:render_text, cache) false + else + controller.action_cache_path = action_cache_path end end # override to pass along the ttl hash def after(controller) return if !@actions.include?(controller.action_name.intern) || controller.rendered_action_cache - controller.write_fragment(ActionController::Caching::Actions::ActionCachePath.path_for(controller), controller.response.body, action_ttl(controller)) + controller.write_fragment(controller.action_cache_path.path, controller.response.body, action_ttl(controller)) end private