Forum: Ruby on Rails Showing errors for saves of 2 records

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.
94967e85b67858f0e47ac08926f0a157?d=identicon&s=25 GS (Guest)
on 2007-02-28 08:59
(Received via mailing list)
I accept input for two related records from a user form and in my
controller I do the following:

Record1.transaction do!!

Record2 is related to record1, and can only be saved if Record1 is
saved. Now obviously if the user entered some invalid input for
Record1, then the verification on save of Record1 will fail.
Unfortunately, because of this isn't called, and I don't
have any information on whether the user's input for Record2 is valid.
As a result, when the user gets kicked back to the form, they only see
errors related to Record1 input. They may fix all of that, press
submit again, and then see new errors for the Record2 save.

This is no good, of course. I need to be able to show errors to the
user for the input related to both Record1 and Record2. How can I do

This topic is locked and can not be replied to.