aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorAndrew DiMichele <backflip@gmail.com>2012-10-19 12:21:01 -0700
committerAndrew DiMichele <backflip@gmail.com>2012-10-19 17:36:34 -0700
commitf48b7cc053a991404f973ca59dfede87ff6492db (patch)
tree773e469a6fd3ebeb1e1b1cf91dd115f0c8fbc1a7 /activerecord/test
parent2268859dafadebc054087751c4349225979550f1 (diff)
downloadrails-f48b7cc053a991404f973ca59dfede87ff6492db.tar.gz
rails-f48b7cc053a991404f973ca59dfede87ff6492db.tar.bz2
rails-f48b7cc053a991404f973ca59dfede87ff6492db.zip
Changed scope for "taken" error message translation to decrease precedence
Moved activerecord.errors.messages.taken to errors.messages.taken so that translations for, e.g., errors.attributes.email.taken don't get overridden. Test that the translation for 'taken' can be overridden
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/validations/i18n_generate_message_validation_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb b/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb
index 2f5ee32538..174d96aa4e 100644
--- a/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb
+++ b/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb
@@ -54,4 +54,9 @@ class I18nGenerateMessageValidationTest < ActiveRecord::TestCase
end
end
+ test "translation for 'taken' can be overridden" do
+ I18n.backend.store_translations "en", {errors: {attributes: {title: {taken: "Custom taken message" }}}}
+ assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, :value => 'title')
+ end
+
end