Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

make ActiveRecord::Errors.default_error_messages look up translated e…

…rror messages
  • Loading branch information...
commit 2fe4d350e98d7f825cf3d1f9233075a5a79e32a1 1 parent fdb5f81
@svenfuchs svenfuchs authored
Showing with 7 additions and 26 deletions.
  1. +7 −26 activerecord/lib/active_record/validations.rb
View
33 activerecord/lib/active_record/validations.rb
@@ -18,37 +18,18 @@ def initialize(record)
# determine whether the object is in a valid state to be saved. See usage example in Validations.
class Errors
include Enumerable
+
+ class << self
+ def default_error_messages
+ # TODO deprecate this?
+ :'active_record.error_messages'.t
+ end
+ end
def initialize(base) # :nodoc:
@base, @errors = base, {}
end
- # @@default_error_messages = {
- # :inclusion => "is not included in the list",
- # :exclusion => "is reserved",
- # :invalid => "is invalid",
- # :confirmation => "doesn't match confirmation",
- # :accepted => "must be accepted",
- # :empty => "can't be empty",
- # :blank => "can't be blank",
- # :too_long => "is too long (maximum is %d characters)",
- # :too_short => "is too short (minimum is %d characters)",
- # :wrong_length => "is the wrong length (should be %d characters)",
- # :taken => "has already been taken",
- # :not_a_number => "is not a number",
- # :greater_than => "must be greater than %d",
- # :greater_than_or_equal_to => "must be greater than or equal to %d",
- # :equal_to => "must be equal to %d",
- # :less_than => "must be less than %d",
- # :less_than_or_equal_to => "must be less than or equal to %d",
- # :odd => "must be odd",
- # :even => "must be even"
- # }
- #
- # # Holds a hash with all the default error messages that can be replaced by your own copy or localizations.
- # cattr_accessor :default_error_messages
-
-
# Adds an error to the base object instead of any particular attribute. This is used
# to report errors that don't tie to any specific attribute, but rather to the object
# as a whole. These error messages don't get prepended with any field name when iterating
Please sign in to comment.
Something went wrong with that request. Please try again.