Merging Error Messages


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.




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).



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.