aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-05-06 16:40:45 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-05-06 16:40:45 -0300
commit29ae431c51dea6e50abf98b6d62dbfd4828ceab7 (patch)
tree5a3f5fd58a5920aeb0ce7be3cff3274bd2feb559 /actionview/lib
parentadc10d2dc523ee1480e3b9d31ad2e264ee235bf4 (diff)
parentd5f2c5c20e2f8f104a1e67ba81166874cc472b9e (diff)
downloadrails-29ae431c51dea6e50abf98b6d62dbfd4828ceab7.tar.gz
rails-29ae431c51dea6e50abf98b6d62dbfd4828ceab7.tar.bz2
rails-29ae431c51dea6e50abf98b6d62dbfd4828ceab7.zip
Merge pull request #14997 from jpcody/nested_value_i18n
Include label value in i18n attribute lookup
Diffstat (limited to 'actionview/lib')
-rw-r--r--actionview/lib/action_view/helpers/tags/label.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionview/lib/action_view/helpers/tags/label.rb b/actionview/lib/action_view/helpers/tags/label.rb
index 6335e3dd4d..a5bcaf8153 100644
--- a/actionview/lib/action_view/helpers/tags/label.rb
+++ b/actionview/lib/action_view/helpers/tags/label.rb
@@ -35,9 +35,9 @@ module ActionView
if block_given?
content = @template_object.capture(&block)
else
+ method_and_value = tag_value.present? ? "#{@method_name}.#{tag_value}" : @method_name
content = if @content.blank?
@object_name.gsub!(/\[(.*)_attributes\]\[\d+\]/, '.\1')
- method_and_value = tag_value.present? ? "#{@method_name}.#{tag_value}" : @method_name
if object.respond_to?(:to_model)
key = object.class.model_name.i18n_key
@@ -51,7 +51,7 @@ module ActionView
end
content ||= if object && object.class.respond_to?(:human_attribute_name)
- object.class.human_attribute_name(@method_name)
+ object.class.human_attribute_name(method_and_value)
end
content ||= @method_name.humanize