Exception: ActiveFedora::AssociationTypeMismatch

Inherits:
ActiveFedoraError show all
Defined in:
lib/active_fedora/errors.rb

Overview

Raised when an object assigned to an association has an incorrect type.

class Ticket < ActiveFedora::Base
  has_many :patches
end

class Patch < ActiveFedora::Base
  belongs_to :ticket, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isComponentOf
end

# Comments are not patches, this assignment raises AssociationTypeMismatch.
@ticket.patches << Comment.new(content: "Please attach tests to your patch.")