I need to add validation on a before_validation model filter. How can I do that?
Thanks in advance
—
EDIT
I didn’t express myself correctly. I need to add validation on a callback like that:
validate :check_length
def check_length
if my_conditional
validates_length_of :name, :minimum => 5
else
validates_length_of :name, :minimum => 7
end
You will have to create a method and call it from the callback
or if the validation is not dealing with an attribute (or field)