Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Core changes in fragment_cache.rb

#76

In the before method, the way the action_cache_path is generated has been changed.

Used to be:

action_cache_path = ActionController::Caching::Actions::ActionCachePath.new(controller)

Is now:

action_cache_path = ActionCachePath.new(controller, path_options_for(controller, @options))

There is an additional private method path_options_for that does some nice magic.

Was running into problems with incorrect cache paths being generated for nested resources... ie: /blogs and /groups/xxxx/blogs were both keyed as /blogs.

Didn't have time to dig into the specifics, and don't have time to write a patch... but just thought I'd throw it out there that this method has changed quite a bit ;) I ran into this bug, patched locally (very hacky like), then realized it had changed in core... go figure.

Will catch up on this ticket when I have some time... assuming it is still here. Word up !

Reported by Dylan Stamat · August 3rd, 2007 @ 08:35 PM

State: hold
Milestone: none
Assigned to: Chris Wanstrath Chris Wanstrath

Activity

  1. Chris Wanstrath
    Chris Wanstrath
    • State changed from new to hold

    Cool, please re-open when you have more time or a fix. Thanks for letting us know about this.

    August 3rd, 2007 @ 08:35 PM

  2. Will Bryant
    Will Bryant

    How about:

    --- old-connect-2/vendor/plugins/cache_fu/lib/acts_as_cached/fragment_cache.rb  2007-11-26 13:08:39.000000000 +1300
    +++ new-connect/vendor/plugins/cache_fu/lib/acts_as_cached/fragment_cache.rb    2007-11-26 13:08:41.000000000 +1300
    @@ -58,9 +58,8 @@
               if @options
                 action_cache_path = ActionController::Caching::Actions::ActionCachePath.new(controller, path_options_for(controller, @options))
               else
    -            action_cache_path = ActionController::Caching::Actions::ActionCachePath.new(controller)
    +            action_cache_path = ActionController::Caching::Actions::ActionCachePath.new(controller, controller.params)
               end
    -          
               # should probably be like ActiveRecord::Validations.evaluate_condition.  color me lazy.
               if conditional = @actions[controller.action_name.intern][:if]
                 conditional = conditional.respond_to?(:call) ? conditional.call(controller) : controller.send(conditional)
    @@ -87,7 +86,7 @@
             def after(controller)
               return if !@actions.include?(controller.action_name.intern) || controller.rendered_action_cache
               # 1.2.x compatibility
    -          path = controller.respond_to?(:action_cache_path) ? controller.action_cache_path.path : ActionController::Caching::Actions::ActionCachePath.path_for(controller)
    +          path = controller.respond_to?(:action_cache_path) ? controller.action_cache_path.path : ActionController::Caching::Actions::ActionCachePath.path_for(controller, controller.params)
               controller.write_fragment(path, controller.response.body, action_ttl(controller))
             end
    

    November 25th, 2007 @ 04:10 PM

  3. Will Bryant
    Will Bryant

    Hmm, didn't mean to remove that blank line in the middle there, leave that out of the patch :)

    November 25th, 2007 @ 04:15 PM

  4. Dylan Stamat
    Dylan Stamat

    Awesome, thanks Will :) Chris, could you check it out and possibly apply or reopen ? Thanks !

    November 25th, 2007 @ 04:55 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.