Stack level too deep, alias_method_chain and an alternative

Hi

I’ve been running into some weird behavior with our engine app. Latest
Rails, latest Engines plugin. When turning config.reload_plugins = true,
the
first request to our application runs fine, then we get an error, “stack
trace too deep”. The error is always coming from an asset tag helper. I
looked at the code for “module Engines::RailsExtensions::
AssetHelpers” and found that alias_method_chain is at work for providing
module method overrides. When I remove the Engines AssetHelpers methods
(comment them out) – the error goes away, of course our asset href’s
are
all incorrect (no plugin name), but this led me to an experiment that
solved
the problem. Instead of using alias_method_chain, why not just define
the
regular ActionView::Helpers::AssetTagHelper methods, then call “super”?
Obviously the way that the methods are mixed into ActionView would need
to
change, but this does the trick right here:

ActionView::Base.class_eval do
include Engines::RailsExtensions::AssetHelpers
end

My entire fix can be found here: rails_engines_asset_mixin · GitHub

I know there are a few more places that Rails includes
ActionView::Helpers::AssetTagHelper, but not more than 3 or 4.

James, can I provide a “real” patch if you find this an acceptable
solution?

Matt