Forum: Ruby on Rails Best Idiom for form using multiple models

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.
List R. (Guest)
on 2006-01-16 01:47
What's the best idion when you need to present the user a single form,
whose data is loaded into several models?

* How to display the errors together
* How do you handle one model being valid but not the other
* How do you do validations if one model's validity depends on the other

(I guess transactions could be used to handle #2 and #3...)
Jules (Guest)
on 2006-01-16 16:34
Transactions can be used, but you can also validate by hand.

For #1 I would write a helper just like error_messages_for(), but then
something that accepts an array of models and creates error messages

The #{attribute} of #{themodel} should be at least 4 characters.

This topic is locked and can not be replied to.