Is there a guide to monkey patching Radiant out there somewhere? I Googled
around but didn't find anything, so I tried the serendipitous approach:

    % script/generate extension absolute_urls
    [...snip...]

I then created app/models/page.rb (the hack in the old Radiant site I'm
upgrading was made to Radiant's app/models/page.rb), which looks like this:

class Page < ActiveRecord::Base
  module AbsoluteURLHack
    def url
      # If the slug begins with a slash, then it is an absolute url.  Do
      # not build up the url using the parent's url.
      if parent? && !(slug =~ /^\//)
        parent.child_url(self)
      else
        clean_url(slug)
      end
    end
  end

  include AbsoluteURLHack
end


I didn't touch any of the other files that script/generate created for me.

When I run script/server, I'm now seeing something really strange--this
extension doesn't fail, but one of my other extensions does (it works when I
remove this new extension):

=> Booting Mongrel
=> Rails 2.3.4 application starting on http://0.0.0.0:3000
Could not load extension from file: static_publisher_extension.
#<NoMethodError: undefined method `description' for #<Class:0xb7e28dc8>>
/workplace/octane/env/DkreftCMSWebsiteContent-1.0/runtime/lib/ruby/gems/1.8/gems/radiant-0.8.2/vendor/rails/activesupport/lib/active_support/dependencies.rb:417:in
`load_missing_constant': Object is not missing constant
ArchiveYearIndexPage! (ArgumentError)


Aside from the really bizarre wording of that last line ("object is
*not* missing
constant"????), I don't understand what's going wrong. Could someone help me
with this? If there's a doc that will alleviate me of my ignorance, by all
means, point me at it.

Thanks.

-dan

Reply via email to