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.
Thx,
Andy.
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.
Thx,
Andy.
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).
Jodi
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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs