[Apologies if this is a dupe. After the first attempt at posting it, 20
minutes passed, I replied to another thread, saw that reply and other
messages, but not this one. Watch all 2-3 copies show up an hour from
now.]
I’ve got a method I want to fire off whenever a model in a given AR
class is updated. However, it’s not happening, and there are two likely
culprits:
-
The updates are all made via the built-in in-place editors. They
update the data properly. Maybe the after_save callback isn’t made when
an in-place editor is involved. -
The class itself is defined in a plugin, in this case
ActsAsCommentable, so maybe I’m just putting my callback declaration in
the wrong place. In this case, I’m putting it in my own module as
follows:
module CommentableExtensions
module Juixe
module Acts #:nodoc:
module Commentable #:nodoc:
module ClassMethods
def acts_as_commentable
include IdxFetcher
after_update :update_idx
serialize :feed
end
private
def update_idx
update_idx_feed(self)
logger.info 'Called update_idx.'
end
end
end
end
end
end
I know CommentableExtensions is loading because the serialize
declaration is working. However, I don’t think the callback is
triggering, because the message doesn’t get logged.
Should I be putting my callback somewhere else? How do I extend class
Comment, which is in the plugin, not in models/*? Or is this an issue
with callbacks and in_place_edit?
Thanks.