aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-05 06:09:33 -0800
committerJosé Valim <jose.valim@gmail.com>2011-12-05 06:09:33 -0800
commit2985151000b9949474b8b575e25bf7ced387da02 (patch)
treee95b1014ed2d3420a03c093583d8ae411a2d55a0 /activemodel/test/cases
parentbe482bd6d6d83aad6c281925e3a1c776bfa5e7cd (diff)
parentdff19f7be2584d9eaa869de14a919aa70d029d92 (diff)
downloadrails-2985151000b9949474b8b575e25bf7ced387da02.tar.gz
rails-2985151000b9949474b8b575e25bf7ced387da02.tar.bz2
rails-2985151000b9949474b8b575e25bf7ced387da02.zip
Merge pull request #3859 from kuroda/human_attribute_name
Fix human_attribute_name to handle names with dots
Diffstat (limited to 'activemodel/test/cases')
-rw-r--r--activemodel/test/cases/translation_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activemodel/test/cases/translation_test.rb b/activemodel/test/cases/translation_test.rb
index 1b1d972d5c..c3d60d6c8b 100644
--- a/activemodel/test/cases/translation_test.rb
+++ b/activemodel/test/cases/translation_test.rb
@@ -56,6 +56,16 @@ class ActiveModelI18nTests < ActiveModel::TestCase
assert_equal 'person gender attribute', Person::Gender.human_attribute_name('attribute')
end
+ def test_translated_nested_model_attributes
+ I18n.backend.store_translations 'en', :activemodel => {:attributes => {:person => {:"addresses/street" => 'Street'}}}
+ assert_equal 'Street', Person.human_attribute_name('addresses.street')
+ end
+
+ def test_translated_nested_model_attributes_with_deprecated_lookup_style
+ I18n.backend.store_translations 'en', :activemodel => {:attributes => {:person => {:addresses => {:street => 'Street'}}}}
+ assert_equal 'Street', Person.human_attribute_name('addresses.street')
+ end
+
def test_translated_model_names
I18n.backend.store_translations 'en', :activemodel => {:models => {:person => 'person model'} }
assert_equal 'person model', Person.model_name.human