Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated README

  • Loading branch information...
commit 9e9d6cfd71126b66722a73c69846352ed42f023f 1 parent 47fe6e4
Jeremy Durham authored
Showing with 34 additions and 52 deletions.
  1. +0 −52 README
  2. +34 −0 README.md
52 README
View
@@ -1,52 +0,0 @@
-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'
-
-Nigel Ramsay added the ability to specify a proc to generate the message.
-
- validates_presence_of :assessment_answer_option_id,
- :message => Proc.new { |aa| "#{aa.label} (#{aa.group_label}) is required" }
-
- which gives an error message like: Rate (Accuracy) is required
-
-
-
-
-Detail
-------
-
-Redefine the ActiveRecord::Errors::full_messages method:
- 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
-(1) they begin with '^' in which case the attribute name is omitted.
- E.g. validates_acceptance_of :accepted_terms, :message => '^Please accept the terms of service'
-(2) the message is a proc, in which case the proc is invoked on the model object.
- E.g. validates_presence_of :assessment_answer_option_id,
- :message => Proc.new { |aa| "#{aa.label} (#{aa.group_label}) is required" }
- which gives an error message like:
- Rate (Accuracy) is required
-
-
-Download
---------
-
-http://rubyforge.org/projects/custom-error-message/
-
-
-Bugs & feedback
----------------
-
-Please send bug reports, patches and feedback to David Easley at easleydp@gmail.com
34 README.md
View
@@ -0,0 +1,34 @@
+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)
Please sign in to comment.
Something went wrong with that request. Please try again.