aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorSven Fuchs <svenfuchs@artweb-design.de>2009-08-26 19:22:56 +0200
committerJeremy Kemper <jeremy@bitsweat.net>2009-08-26 11:29:16 -0700
commitd672a14ee766e86c606db566dd073a3d2332cc60 (patch)
tree24eebdbab270db76c8a99306472a9c1fec90d064 /activerecord/lib
parentadedf72821a5623227ce91e6b298838e692477e4 (diff)
downloadrails-d672a14ee766e86c606db566dd073a3d2332cc60.tar.gz
rails-d672a14ee766e86c606db566dd073a3d2332cc60.tar.bz2
rails-d672a14ee766e86c606db566dd073a3d2332cc60.zip
allow ActiveRecord#RecordInvalid exception message to be localized
[#2754 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/locale/en.yml1
-rw-r--r--activerecord/lib/active_record/validations.rb3
2 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/locale/en.yml b/activerecord/lib/active_record/locale/en.yml
index bf8a71d236..092f5f0023 100644
--- a/activerecord/lib/active_record/locale/en.yml
+++ b/activerecord/lib/active_record/locale/en.yml
@@ -23,6 +23,7 @@ en:
less_than_or_equal_to: "must be less than or equal to {{count}}"
odd: "must be odd"
even: "must be even"
+ record_invalid: "Validation failed: {{errors}}"
# Append your own errors here or at the model/attributes scope.
# You can define own errors for models or model attributes.
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb
index a7fa98756e..5fc41cf054 100644
--- a/activerecord/lib/active_record/validations.rb
+++ b/activerecord/lib/active_record/validations.rb
@@ -12,7 +12,8 @@ module ActiveRecord
attr_reader :record
def initialize(record)
@record = record
- super("Validation failed: #{@record.errors.full_messages.join(", ")}")
+ errors = @record.errors.full_messages.join(I18n.t('support.array.words_connector', :default => ', '))
+ super(I18n.t('activerecord.errors.messages.record_invalid', :errors => errors))
end
end