dasil003 / custom-err-msg forked from gumayunov/custom-err-msg

Fork of svn://rubyforge.org/var/svn/custom-err-msg

This URL has Read+Write access

dasil003 (author)
Wed Feb 04 15:02:41 -0800 2009
commit  1f6b7fa3ec3d679ea7a241d6e196e65066f8b1c4
tree    593729724df5800cc26c2507204581916c0fcd73
parent  d9671a635f93500d241b0897e7e573f29c2a6d7d
name age message
file MIT-LICENSE Sat Feb 07 10:59:50 -0800 2009 ActiveResource::Errors support added Signed-of... [dasil003]
file README Wed Oct 08 19:11:48 -0700 2008 Changed README and minor fixes [dcadenas]
file Rakefile Wed Oct 08 05:11:31 -0700 2008 Patch from Daniel Cadenas (http://github.com/dc... [gumayunov]
file init.rb Sat Feb 07 10:59:50 -0800 2009 ActiveResource::Errors support added Signed-of... [dasil003]
directory lib/ Loading commit data...
directory spec/ Wed Oct 08 19:11:48 -0700 2008 Changed README and minor fixes [dcadenas]
README
Custom Error Message
====================

This plugin gives you the option to not have your custom validation error message
prefixed with the attribute name. Ordinarily, if you have, say:

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

You'll get the following error message:

    Accepted terms Please accept the terms of service

This plugin allows you to omit the attribute name for specific messages. All you have to do
is begin the message with a '^' character. Example:

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

The plugin also lets you use procs instead of strings. Example:

    validates_acceptance_of :accepted_terms, :message => Proc.new {|service| "You must accept the terms of the service 
    #{service.name}" }'

Detail
------

Redefines method:
 
 ActiveRecord::Errors::full_messages

 Returns all the full error messages in an array. 'Base' messages are handled as usual.
 Non-base messages are prefixed with the attribute name as usual UNLESS they begin with '^'
 in which case the attribute name is omitted.

Source
------

http://github.com/gumayunov/custom-err-msg/tree