after_save in plugin

Dear list,
I am trying to override an after_save callback declared in main app
using plugin.
The main model class is:

class WorkHours < ActiveRecord::Base
  after_save :after_save_call_back
  def after_save_call_back
    logger.debug "after save called"

And in my plugin (in the lib directory) :

module WorkHoursPatch
# cattr_accessor
def self.included(base) # :nodoc:
   base.logger.debug "inlcuded called"
   base.send(:include, InstanceMethods)
     >callback> callback.method == :after_save_call_back
   base.send(:after_save, :after_save_call_back_patched)

module ClassMethods


module InstanceMethods
  def after_save_call_back_patched
    logger.debug "overriden after save called"
   # Wraps the association to get the Deliverable subject. Needed for
   # Query and filtering
   # def is_new
   # unless self.is_new.nil?
   # return self.is_new
   # end
   # return false;
   # end

I think your issue may be a mixup with class instance and instance variables.

However, what’s the issue you are having with all this? Are you getting any error messages?

Thanks Tom ,
I have actually figured out the problem.

Seems like since the lib of the plugin is not reloaded on every request

but the main app is .The plugin override works for first request but the

original methods are restored the next one.

The solution that worked for me was wrapping our monkey-patch in a callback.