Error messages and models.

Sam Donaldson wrote:

Hi,

I've limited my error_messages_for method to just spit out the first
error it has in the object but the problem is that the first error is
not always the one that gets printed out. If I have a form, and if
there were multiple erorrs, then I'm finding that the first logical
error on the form is not being printed out. I would like to always just
print out the first logical error. What sequencing does rails follow
while adding errors into the errors object. How can I accomplish this.
I definitely don't want all the errors printed out.

Thanks.

--
Posted via http://www.ruby-forum.com/.

Not sure, but I would bet that it is related to the order in which you
define your validations.

BTW, you can mash your errors for one field together by doing this..

@item.errors.on('field').to_sentence

_Kevin