Best Idiom for form using multiple models


#1

What’s the best idion when you need to present the user a single form,
whose data is loaded into several models?

Issues:

  • 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…)


#2

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
like:

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

Jules