views:

12

answers:

0

In my rails application, I have two separate plugins that both call a alias_method_chain on a core method.

Core Rails

def some_method

In PlugIn1

def some_method_with_extra_feature_one
  some_method_without_feature_one
end
alias_method_chain :some_method, :extra_feature_one

In PlugIn2

def some_method_with_extra_feature_two
  some_method_without_feature_two
end
alias method_chain :some_method, :extra_feature_two

I almost positive that only the first plugin's alias method is being called (I'm guessing that rails loads the plugins in alphabetical order), but not the second alias. However, I would like both of them to be called...

some_method_with_extra_feature_one --> some_method_with_extra_feature_two --> some_method

Is this possible without deliberating making a call to from the first plugin to the second plugin or should I just avoid alias_method_chain altogether.