Using benchmark method

Hi,

I’m trying to use the benchmark method (from Module
ActionController::Benchmarking::ClassMethods).

But I get a “undefined method benchmark.”

I’m trying to use it from inside a method in a subclass of
ActionController::Caching::Sweeper

Ideas much appreciated.

Thanks,

Larry


class CacheSweeper < ActionController::Caching::Sweeper
  # sweeps the page cache for the conference site pages

  observe Conference

  def after_save(conference)
    dir = "#{page_cache_directory}/cs/conference.id"
    benchmark "Expired directory: #{dir}" do
      FileUtils.remove_dir(dir) # pg 231 -- Ruby Cookbook
    end
  end
end