Raised when object assigned to association is of incorrect type.
Example:
class Ticket < ActiveRecord::Base
has_many :patches
end
class Patch < ActiveRecord::Base
belongs_to :ticket
end
and somewhere in the code:
@ticket.patches << Comment.new(:content => "Please attach tests to your patch.") @ticket.save