Class

AssociationTypeMismatch

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

Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.