I'm attempting to monkey patch a static method in the Page class and it
isn't going so well, but the strange thing is that I've already patched some
instance methods in the Page class in other extensions using the same
approach, but this particular patch just isn't "taking" for some reason. I'm
absolutely sure that the module is getting loaded, but the methods just
aren't getting overridden. Here's what I've got:

# File: vendor/extensions/foo_absolute_slugs/foo_absolute_slugs_extension.rb
class FooAbsoluteSlugsExtension < Radiant::Extension
  version "1.0"
  description "Allows for slugs to begin with a '/'"
  url ""

  def activate
    Page.send :include, FOO::AbsoluteSlugs
  end
end

# File: vendor/extensions/foo_absolute_slugs/lib/foo/absolute_slugs.rb:
module FOO
  module AbsoluteSlugs
    def self.find_by_url(url, live = true)
      # The message below never gets printed to stderr
      $stderr.puts "XXX Calling static find_by_url"
      # ...snip...
    end
  end
end


Anyone have any ideas on what's going wrong here?

-dan

Reply via email to