Custom Error Message Rails plugin
Ruby
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec Grouped all requires together Jan 22, 2011
.rvmrc Added .rvmrc and Gemfile Mar 29, 2011
Gemfile Added .rvmrc and Gemfile Mar 29, 2011
Gemfile.lock Added .rvmrc and Gemfile Mar 29, 2011
LICENSE Updated LICENSE Jan 22, 2011
README.md Updated README Jan 22, 2011
Rakefile Cleaned out Rakefile and updated to rspec 2.x Dec 18, 2010
custom_error_message.gemspec Updated for 1.1.1 release Oct 6, 2011
init.rb

README.md

Custom Error Message

This plugin gives you the option to not have your custom validation error message prefixed with the attribute name.

Rails 3 and Ruby 1.9

Custom Error Message is Rails 3 and Ruby 1.9 compatible

Usage

Sometimes generated error messages don't make sense.

validates_acceptance_of :accepted_terms, :message => 'Please accept the terms of service'

This generates the error message:

Accepted terms Please accept the terms of service

This plugin uses the carat (^) to omit the name of the attribute from error messages:

validates_acceptance_of :accepted_terms, :message => '^Please accept the terms of service'

This now generates:

Please accept the terms of service

CREDITS

This plugin was originally written by David Easley (easleydp@gmail.com)