In upgrading our site from radiant 0.8.1 to 1.0 we've come across a problem
in one of our extensions, multi_site.
It adds a prepend_before_filter to ApplicationController to determine what
site the user is loading, based on the domain name. This was included in
the multi_site_extensions.rb file within the activate method, previously,
like so:
ApplicationController.send :include,
MultiSite::ApplicationControllerExtensions
which results in the filter adding like so:
def self.included(base)
base.class_eval {
prepend_before_filter :set_site
}
end
This is no longer working. In examining the filter chain, the set_site
filter is not a part of it. I also added some logging into the method that
adds the filter, and it appears that the filter isn't being added until
after the controller has completed processing. I'm assuming this is due to
a change in how Radiant initializes extensions in 1.0, but I'm not sure.
As a test, I added the include within the
config/initializers/radiant_config.rb structure that newer extensions use.
Doing it this way resulted in the filter working the first time (because
the site had just initialized) but not after.
My guess is there's a proper way to be extending ApplicationController with
a before_filter in Radiant 1.0, but I'm not sure what it is. Any help would
be appreciated! Thank you!
Eric