class ActiveFedora::Associations::Builder::CollectionAssociation

def self.define_callback(model, callback_name, name, options)

def self.define_callback(model, callback_name, name, options)
  full_callback_name = "#{callback_name}_for_#{name}"
  # TODO : why do i need method_defined? I think its because of the inheritance chain
  # See https://github.com/samvera/active_fedora/issues/1333
  model.class_attribute full_callback_name.to_sym unless model.method_defined?(full_callback_name)
  callbacks = Array(options[callback_name.to_sym]).map do |callback|
    case callback
    when Symbol
      ->(_method, owner, record) { owner.send(callback, record) }
    when Proc
      ->(_method, owner, record) { callback.call(owner, record) }
    else
      ->(method, owner, record) { callback.send(method, owner, record) }
    end
  end
  model.send("#{full_callback_name}=", callbacks)
end