rails/rails — pull request #8602 by acesuares (2012-12-24 19:40:51+00:00)
Title: Validation hints give hints about what to submit

In a form, attributes might have validations, like :presence => true.

Validation Hints would tell you 'this field can not be blank' or similar text that is derived from the Validator or from text you provide.

It can be used to display tooltips on forms so the user know what or what not to fill in before he or she submits.

The messages are configurable, and translatable.

class Person
include ActiveModel::Validations

attr_accessor :first_name, :last_name

validates :name, :presence => true
validates :last_name, :length => { :within => 1...5 }
end

Person.new.hints[:first_name] => ["can't be blank"]
Person.new.hints[:last_name] => ["must not be shorter than 1 characters", "must not be longer than 4 characters"]
Person.new.hints.messages => {:id=>[], ["must not be shorter than 1 characters", "must not be longer than 4 characters"], :password=>["must not....."], :name => ["can't be blank"] }