class ActiveFedora::Associations::Builder::HasAndBelongsToMany

:nodoc:

def build

def build
  reflection = super
  define_destroy_hook
  reflection
end

def define_destroy_hook

def define_destroy_hook
  # Don't use a before_destroy callback since users' before_destroy
  # callbacks will be executed after the association is wiped out.
  # TODO Update to destroy_associations
  name = self.name
  model.send(:include, Module.new {
    class_eval <<-RUBY, __FILE__, __LINE__ + 1
      def destroy          # def destroy
        #{name}.clear      #   posts.clear
        super              #   super
      end                  # end
    RUBY
  })
end

def validate_options

def validate_options
  super
  if !options[:predicate]
    raise "You must specify a predicate for #{name}"
  elsif !options[:predicate].kind_of?(RDF::URI)
    raise ArgumentError, "Predicate must be a kind of RDF::URI"
  end
end