Problem with alias_method in a plugin


I’m doing my first plugin, based on attachment_fu structure. Here’s
the code: Parked at Loopia.

The problem is that the meta_tag method doesn’t seem to be

I can call model_instance.original_meta_tag and it return same thing
as model_instance.meta_tag, so the aliasing works.
I can call and it correctly returns class of the
model, so instance method also works.

I’ve set breakpoints on both methods (meta_tag and foo) - calling
model_instance.meta_tag doesn’t trigger debugger and triggers debugger. So the redefined meta_tag method
is not called at all.

If I copy all this code (has_one, alias_method and redefine meta_tag)
directly into the model it works fine.

Any ideas?