In the example code in this Pastie Parked at Loopia, I'm
observing behavior I can't explain. I'm making two calls to
alias_method_chain to extend create_table and drop_table. The
create_table alias chain works as expected. While debugging the
drop_table_with alias chained method is never entered.
Thanks for looking, but I believe I've tried what you suggest.
1) I believe the extension to the module is included in the extended
module globally, because of the following line in environment.rb
ActiveRecord::ConnectionAdapters::SchemaStatements.send(:include,AuditingTables::ActiveRecord::ConnectionAdapters::SchemaStatements)
2) I've used a debugger and seen that the failure_type_with_foo (my
drop_table_with_auditing_table) in your example is never entered.
However my create_table_with_auditing_table, which is defined and
included in an identical manner is always entered.
Could something be overriding or blocking my extension of drop_table?
Yeah, that's the whole point of what I showed you. No amount of
monkeypatching in the Failure module can compensate for the fact that
the SomethingThatFails class defines its own failure_type() method.
Try to figure out the type of the object you are calling drop_table()
on, then look at the rails source to see whether that class in
question happens to define its own drop_table method.
If you're impatient you can always just search for "def drop_table" in
the rails source.
Chances are, you're going to have to monkeypatch that class rather
than SchemaStatements.