Closed manojmj92 closed 6 years ago
I think if you just add the message after the validation it overrides the default message e.g. validates_date :birthday, message => 'Not a valid date'
There is no feature in ActiveRecord to remove the attribute name when displaying errors using full_messages
which is the default for form inputs I believe. You'd need to display the individual error message per attribute.
See Rails Guides
Hey I have the same problem, I've checked the rails guide but couldn't find my answer.
Usually I would define a custom method with sth like this
errors.add(:base, 'You must be at least 18 years old')
but I don't know how to do it here.
Is there any way to do the same with the gem?
Does any other field you are validating that is not a datetime show the error message in a different way?
When I try to save an attribute (say, birthday) with invalid date, I get the following validation error on the form
birthday is not a valid date
.I need a way to hide the
birthday
part from the error message. Exposing my attribute name doesn't seem fit to me. For eg: My database column could be named justbd
orbirth
or anything and showingbd is not a valid date
seems inappropriate.Anyway to do this?