Model validators

If i run two validators on the same model attribute and they both fail,
two messages show. Is there any way to only show the first failure
message?

Instead of using the pre-formatted error_messages_for() you could
create your own helper …

def my_error_messages_for
error_attrs = []
Object.errors.each do |attr,msg|
unless errory_attrs.include? attr
…define your message and stuff…
error_attrs << attr # add the attribute to the array of already
processed attribute
end
end
end

that code is in no way complete and not guaranteed to be correct …
for an idea how to do the “define your error messages and stuff” part,
have a look at the source of error_messages_for() in the Rails API docs

just had a look at my above code and wanted to make clear that the
whole method is NOT gonna work like this, it has no return value, the
def line is missing the variables it should get passed etc … but i
think you get the idea …