Is there a way to remove a specific error or errors on a specific
attribute? I see there is a object.errors.clear, but that clears all
the errors associated with the object. I would like to do something
like object.errors.clear('email'), where any errors associated with
the email attribute are cleared out.
dear sender,
i�m out of the office until may 29th.
your email will not be forwarded.
for urgent stuff please contact joern@fork.de
kind regards,
alexander
I was needing to do a validates_associated but I didn't want the error
message to appear in my view. My answer to this at the time was to
remove the error message once the object had been validated.
However a much better way was to write my own validate statement
def validate
return false unless self.associated_object.valid?
end
This way I'm checking that the associated object is valid without
generating the errors in the first place.
I love the rails validates helpers so much that I forget I can do
validation myself and get all the control I'll ever need.
I was needing to do a validates_associated but I didn't want the error message to appear in my view. My answer to this at the time was to remove the error message once the object had been validated.
However a much better way was to write my own validate statement
def validate
return false unless self.associated_object.valid?
end
This way I'm checking that the associated object is valid without generating the errors in the first place.
I love the rails validates helpers so much that I forget I can do validation myself and get all the control I'll ever need.
You can also use :message => nil option on the validates_associated
statement.