Displaying 1 result from an estimated 1 matches for "workhourspatch".
2012 Jan 28
2
after_save in plugin
...main model class is:
class WorkHours < ActiveRecord::Base
@after_save_call_back_called=0
after_save :after_save_call_back
def after_save_call_back
logger.debug "after save called"
@after_save_call_back_called=1
end
end
And in my plugin (in the lib directory) :
module WorkHoursPatch
# cattr_accessor
def self.included(base) # :nodoc:
base.logger.debug "inlcuded called"
base.extend(ClassMethods)
base.send(:include, InstanceMethods)
base.after_save.delete_if{
|callback| callback.method == :after_save_call_back
}
base.send(:after_save, :after_sav...