I want to customize the error message on a validates_length_of to include the length of the attribute being checked. I know we can do "%{value}" or "%{attribute}" within the message to get those values. Is there a flag we can use to get the length of the attribute? I was hoping to avoid creating a custom validation just to get a pretty message. Additionally, it seems a waste to do count twice on a string when the validator is already doing it.
Here is what I would like:
validates_length_of :a, :b,:c, :d, :e, :maximum => 1000, :message=>"is to long, maximum length is` %{count}, current length is %{actual length here} "
You can use Proc to get the attributes