diff options
author | Tsutomu Kuroda <t-kuroda@oiax.jp> | 2012-06-06 12:45:37 +0900 |
---|---|---|
committer | Tsutomu Kuroda <t-kuroda@oiax.jp> | 2012-06-06 12:50:09 +0900 |
commit | 029936efbe7318e9146c22c6609e1571c7abb0c1 (patch) | |
tree | 03de1881f9b541a357ee3754c5eb952a5665c44f /activemodel/lib | |
parent | 3cba6eee66a4c25b93839ea6fd1da08d7780f2de (diff) | |
download | rails-029936efbe7318e9146c22c6609e1571c7abb0c1.tar.gz rails-029936efbe7318e9146c22c6609e1571c7abb0c1.tar.bz2 rails-029936efbe7318e9146c22c6609e1571c7abb0c1.zip |
Fix human attribute_name to handle deeply nested attributes
This is a back-port of b0e2fc84 to Rails 3.2.
See #5843 and #3859 also.
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/translation.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/translation.rb b/activemodel/lib/active_model/translation.rb index 02b7c54d61..e560d9e2cf 100644 --- a/activemodel/lib/active_model/translation.rb +++ b/activemodel/lib/active_model/translation.rb @@ -44,9 +44,9 @@ module ActiveModel # Specify +options+ with additional translating options. def human_attribute_name(attribute, options = {}) defaults = [] - parts = attribute.to_s.split(".", 2) + parts = attribute.to_s.split(".") attribute = parts.pop - namespace = parts.pop + namespace = parts.join("/") unless parts.empty? if namespace lookup_ancestors.each do |klass| |