--0016e65a0dfcb31375049e9a631c
Content-Type: text/plain; charset=ISO-8859-1
Afaik there is no way to call an instance method of a module without
including it (or extending an Object with it).
But you can make expire_cache a module class method and then call it.
module GroupSweeper
def self.expire_cache(paths)
puts "dummy code"
end
end
class Foo < Bar
def baz(arg)
GroupSweeper.expire_cache(arg)
end
end
2011/3/16 mgerstenblatt / gmail.com <mgerstenblatt / gmail.com>
> Hi, Is there an alternative to calling a Module method from a nested
> class? The code:
>
> module GroupSweeper
>
>
> def expire_cache(paths)
>
> paths.each do |path|
>
> expire_page(path)
>
> end
>
> end
>
>
> class SweeperOne < ActionController::Caching::Sweeper
>
> include GroupSweeper
>
> observe Subject
>
> def after_save(subject)
>
> expire_cache([root_path,subjects_path])
>
> end
>
> def after_destroy(subject)
>
> expire_cache([root_path,subjects_path])
>
> end
>
> end
>
>
> end
>
> How can I call GroupSweeper's expire_cache method from within
> SweeperOne without explicitely including it? Should I not be doing
> this?
>
>
--0016e65a0dfcb31375049e9a631c--