diff options
author | Sven Fuchs <svenfuchs@artweb-design.de> | 2008-06-19 18:31:11 +0200 |
---|---|---|
committer | Sven Fuchs <svenfuchs@artweb-design.de> | 2008-06-19 18:31:11 +0200 |
commit | 2fe4d350e98d7f825cf3d1f9233075a5a79e32a1 (patch) | |
tree | 924797d2fbe4a287dc7b7598bd1ac9617961b54f /activerecord/lib | |
parent | fdb5f810dc41f54f8cdb9c51154ff8987362c13a (diff) | |
download | rails-2fe4d350e98d7f825cf3d1f9233075a5a79e32a1.tar.gz rails-2fe4d350e98d7f825cf3d1f9233075a5a79e32a1.tar.bz2 rails-2fe4d350e98d7f825cf3d1f9233075a5a79e32a1.zip |
make ActiveRecord::Errors.default_error_messages look up translated error messages
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/validations.rb | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index f54fb80137..0ca68989d2 100755 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -18,37 +18,18 @@ module ActiveRecord # 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 |