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.

This project is archived and is in readonly mode.

ActionController::Caching::Sweeping method_missing doesn't take a proc

#1581

If you want to run a controller action that requires a proc it won't get passed along through the sweepers method missing call.

IE, the following will get "no block":

class DevicesController < ApplicationController cache_sweeper :device_sweeper, :only => [ : mymethod ]

def mymethod(&block)

 if block_given?
   yield
 else
   "no block"
 end

end end

class DeviceSweeper < ActionController::Caching::Sweeper observe Device def after_create(device)

mymethod do |page|
  "doing stuff in my block"
end

end end

To fix this, a &block argument has to be added onto the the method missing in ActionController::Caching::Sweeping.

Reported by Tys von Gaza · December 15th, 2008 @ 09:29 PM

State: committed
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Tys von Gaza
    Tys von Gaza
    • Tag changed from 2.2, actioncontroller, bug, caching, sweeper to 2.2, actioncontroller, bug, caching, patch, sweeper
    • Title changed from ActionController::Caching::Sweeping method_missing doesn't take a &block to ActionController::Caching::Sweeping method_missing doesn't take a proc

    Patch for the fix following the guide here: http://rails.lighthouseapp.com/p...

    Not really sure where to get started to add a test for this, advice?

    December 15th, 2008 @ 09:43 PM

  2. Jeremy Kemper
    Jeremy Kemper
    • Milestone cleared.
    • State changed from new to open

    December 15th, 2008 @ 11:04 PM

  3. Repository
    Repository

    (from [dd02af5c7e74b4ea0383b0df87824fb2b37f2243]) Fix for sweepers method_missing missing &block argument [#1581 ActionController::Caching::Sweeping method_missing doesn't take a proc status:committed]

    Signed-off-by: David Heinemeier Hansson david@loudthinking.com http://github.com/rails/rails/co...

    January 27th, 2009 @ 10:13 PM

  4. DHH
    DHH
    • State changed from open to committed

    January 27th, 2009 @ 10:14 PM