Has_many validation

Hi all,
I’ve got a pretty standard has_many relationship here. Customer has_many
items, and the association is being performed like so:

@customer.items << @item

My question regards the best way to perform validation when adding an
item to a customer. Specifically, I need to make sure that a certain
property of the @item matches that of the @customer. Does this type of
validation take place in the Customer model? If so, how? Or should I
create some wrapper around << in the Customer model, which would perform
this validation and created the association? What’s the preferred

Thanks in advanced,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs