Say I have the following model:
class Information < ActiveRecord::Base
...
validates_length_of :name, :minimum=>3, :message=>"should be longer than 3 characters!"
...
What I want to have as an error is:
Information should be longer than 3 characters! (or similar)
and NOT "Information name should be longer than 3 characters!".
Two possible workarounds I've looked at:
human_attribute_name
method (mentioned here): doesn't work with my Rails 2.3.2. :-(- directly do a
information.errors.add "","..." if information.name.length < 3
: however, this removes many useful properties triggered by thevalidated_length_of
method like the special class-tags (for coloring the stuff red).
Any ideas? Thank you for your time.