Displaying 1 result from an estimated 1 matches for "areventcommentlisten".
Did you mean:
areventcommentlistener
2009 Dec 03
1
Ann: ArEvents
...easily attach and detach event listeners, the events
correspond to the active record callbacks.
If you have an existing model, just include the ArEvents module:
ArEventComment.send(:include, ArEvents)
and you can then add event listeners:
ArEventComment.add_ar_event_listener(:before_validation, ArEventCommentListener)
An event listener is simply a class with a class method named trigger
that takes 2 arguments: the event fired and the object fireing the
event:
class ArEventCommentListener
def self.trigger(evt, obj)
puts "event #{evt} triggered by object #{obj.inspect}"
end
end
I...