Forum: Ruby on Rails Merging Error Messages

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.
Andy (Guest)
on 2006-05-20 04:11
How do i merge error messages for two models on the same form? In the
end, i will have one error box with all the errors in it instead of two.


Jodi S. (Guest)
on 2006-05-21 01:19
(Received via mailing list)
Hey there Andy.

I too would like to merge multiple model "errors".  Errors seems to
be using the Enumerable mixin, but at this stage nubiness I'm not
sure how to merge (enumerable doesn't have a merge method).

Any rubyists out there can help with this? (good did prove fruitless).

Bryan D. (Guest)
on 2006-05-21 17:49
There's no easy solution for this, but the easiest workaround I've found
is using @model.errors.full_messages to get the error array, and then
displaying it how you want. You can't use the "error_messages_for"
statement, but honestly its not that hard to code your own error box.
That should get you the level of control you're looking for.
This topic is locked and can not be replied to.