Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Hints for validation
Ruby
branch: master
Failed to load latest commit information.
lib added some classmethods like hints_for(attribute) and has_validations…
.document starting a gem
.gitignore added some stuff
Gemfile starting a gem
LICENSE.txt
README.md updated docs
Rakefile starting a gem
validation_hints.gemspec removed silly dependencies on rvm and thor

README.md

Validation Hints

Delivers hints derived from the validation on a model.

Install

gem 'validation_hints'

Example

class Person < ActiveRecord::Base
  validates :name, :presence => true
  validates :password, :length => { :within => 1...5 }
end
Person.new.hints[:name] => ["can't be blank"]
Person.new.hints[:password] => ["must not be shorter than 1 characters", "must not be longer than 4 characters"]
Person.new.hints.messages => {:id=>[], :password=>["must not be shorter than 1 characters", "must not be longer than 4 characters"], :name => ["can't be blank"] }

Disclaimer

It's work in progress. validation_hints was for the most part derived from activerecord-3.2.3/lib/active_record/errors.rb

Something went wrong with that request. Please try again.