aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionview/lib/action_view/helpers/tags/label.rb2
-rw-r--r--actionview/lib/action_view/helpers/tags/placeholderable.rb2
-rw-r--r--actionview/lib/action_view/helpers/tags/translator.rb8
3 files changed, 6 insertions, 6 deletions
diff --git a/actionview/lib/action_view/helpers/tags/label.rb b/actionview/lib/action_view/helpers/tags/label.rb
index 25f7cafcb8..4159cb105f 100644
--- a/actionview/lib/action_view/helpers/tags/label.rb
+++ b/actionview/lib/action_view/helpers/tags/label.rb
@@ -17,7 +17,7 @@ module ActionView
method_and_value = @tag_value.present? ? "#{@method_name}.#{@tag_value}" : @method_name
content ||= Translator
- .new(object, @object_name, method_and_value, "helpers.label")
+ .new(object, @object_name, method_and_value, scope: "helpers.label")
.call
content ||= @method_name.humanize
diff --git a/actionview/lib/action_view/helpers/tags/placeholderable.rb b/actionview/lib/action_view/helpers/tags/placeholderable.rb
index 0b15a11308..db16ea7b0b 100644
--- a/actionview/lib/action_view/helpers/tags/placeholderable.rb
+++ b/actionview/lib/action_view/helpers/tags/placeholderable.rb
@@ -10,7 +10,7 @@ module ActionView
method_and_value = tag_value.is_a?(TrueClass) ? @method_name : "#{@method_name}.#{tag_value}"
placeholder ||= Tags::Translator
- .new(object, @object_name, method_and_value, "helpers.placeholder")
+ .new(object, @object_name, method_and_value, scope: "helpers.placeholder")
.call
placeholder ||= @method_name.humanize
@options[:placeholder] = placeholder
diff --git a/actionview/lib/action_view/helpers/tags/translator.rb b/actionview/lib/action_view/helpers/tags/translator.rb
index a65bd35f4d..86d7d21308 100644
--- a/actionview/lib/action_view/helpers/tags/translator.rb
+++ b/actionview/lib/action_view/helpers/tags/translator.rb
@@ -2,21 +2,21 @@ module ActionView
module Helpers
module Tags # :nodoc:
class Translator # :nodoc:
- def initialize(object, object_name, method_and_value, i18n_scope)
+ def initialize(object, object_name, method_and_value, scope:)
@object_name = object_name.gsub(/\[(.*)_attributes\]\[\d+\]/, '.\1')
@method_and_value = method_and_value
- @i18n_scope = i18n_scope
+ @scope = scope
@model = object.respond_to?(:to_model) ? object.to_model : object
end
def call
- translated_attribute = I18n.t("#{object_name}.#{method_and_value}", default: i18n_default, scope: i18n_scope).presence
+ translated_attribute = I18n.t("#{object_name}.#{method_and_value}", default: i18n_default, scope: scope).presence
translated_attribute || human_attribute_name
end
private
- attr_reader :object_name, :method_and_value, :i18n_scope, :model
+ attr_reader :object_name, :method_and_value, :scope, :model
def i18n_default
if model