I am using this plugin and trying to extend it:
https://github.com/goncalossilva/subdomain_routes/blob/master/lib/subdomain_routes/url_writer.rb
The plugin heavily modifies some the Rails routing (Rails 2.3.x in this
case, but that's not important)
It usually follows this pattern:
module SubdomainRoutes
module UrlWriter
def self.included(base)
base.alias_method_chain :rewrite, :subdomains
end
def native_plugin_method
...a bunch of code
end
def rewrite_with_subdomains
...code
end
end
end
ActionController::UrlWriter.send :include, SubdomainRoutes::UrlWriter
In my own classes I am attempting to override some of these methods. So
i do this:
module CustomRouting
def native_plugin_method
#successfully invoked
...a bunch of code
super #will call method from SubdomainRoutes::UrlWriter
end
def rewrite_with_subdomains
#method is never invoked
...code
super
end
end
ActionController::UrlWriter.send :include, CustomRouting
The method created with alias_method_chain is never affected! My code
successfully overrides 'native_plugin_method', but it seems to do
nothing with rewrite_with_subdomains, even though everything is
identical.
Is there something about aliased methods that does not resolve in the
same way as standard methods?
--
Posted via
http://www.ruby-forum.com/.