Forum: Ruby on Rails HABTM, push_with_attributes, and validations

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ff43001ac5fe9805aa6ca2e89d3b7b5d?d=identicon&s=25 Jake Janovetz (Guest)
on 2005-11-13 08:16
Is it possible to perform validations on HABTM associations?  That is,
if I have a table like:

I want to 'push_with_attributes' and set the comment field.  Can I do a
validation on the comment field such as validates_presence_of?

Since the association doesn't have a model, where does this validation

67b6389be42524fbd776e44fd35c3d7e?d=identicon&s=25 peter.j.donald (Guest)
on 2005-11-13 11:41
(Received via mailing list)
I think that the path of least resistence would be to introduce a
model object for the relation if you need to doing validation and
other model-like behaviour.
This topic is locked and can not be replied to.