Problem with alias_method in a plugin

Hi,

I’m doing my first plugin, based on attachment_fu structure. Here’s
the code: http://pastie.caboo.se/200797.

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

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 model_instance.foo 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
model_instance.foo 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?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs