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.
Jake J. (Guest)
on 2005-11-13 09: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

peter.j.donald (Guest)
on 2005-11-13 12: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.