Displaying 1 result from an estimated 1 matches for "add_callback".
Did you mean:
  _addcallback
  
2006 Jan 13
1
association callbacks
...before_validation{|model|
        model.class.append_habtm_callbacks if model.has_backup_table?
      }
  ...
  end
  module ClassMethods
      def append_habtm_callbacks
        reflect_on_all_associations.each{ |association|
          if association.macro == :has_and_belongs_to_many
            #add_callback
            add_callback = "before_add_for_#{association.name}"
            class_inheritable_reader(add_callback.to_sym)
            write_inheritable_array(add_callback.to_sym, [:log_add])
            #remove_callback
            remove_callback = "before_remove_for_#{association.n...