aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/tags/placeholderable.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2014-08-29 14:54:08 -0700
committerDavid Heinemeier Hansson <david@loudthinking.com>2014-08-29 14:54:08 -0700
commit7475b43cdbbbf7456e798210cb97ef20f2225166 (patch)
tree04ae517943ccc476ca0a8b9b3bdbb21949a558c1 /actionview/lib/action_view/helpers/tags/placeholderable.rb
parent6a23bf0f4c33151e0cec0648e271dc6f5ab3f686 (diff)
parent4445478df311a74797d8dc4945c40662f9c1442a (diff)
downloadrails-7475b43cdbbbf7456e798210cb97ef20f2225166.tar.gz
rails-7475b43cdbbbf7456e798210cb97ef20f2225166.tar.bz2
rails-7475b43cdbbbf7456e798210cb97ef20f2225166.zip
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'actionview/lib/action_view/helpers/tags/placeholderable.rb')
-rw-r--r--actionview/lib/action_view/helpers/tags/placeholderable.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/tags/placeholderable.rb b/actionview/lib/action_view/helpers/tags/placeholderable.rb
index 313aa725c9..ae67bc13af 100644
--- a/actionview/lib/action_view/helpers/tags/placeholderable.rb
+++ b/actionview/lib/action_view/helpers/tags/placeholderable.rb
@@ -6,6 +6,8 @@ module ActionView
super
if tag_value = @options[:placeholder]
+ placeholder = tag_value if tag_value.is_a?(String)
+
object_name = @object_name.gsub(/\[(.*)_attributes\]\[\d+\]/, '.\1')
method_and_value = tag_value.is_a?(TrueClass) ? @method_name : "#{@method_name}.#{tag_value}"
@@ -15,7 +17,7 @@ module ActionView
end
i18n_default ||= ""
- placeholder = I18n.t("#{object_name}.#{method_and_value}", :default => i18n_default, :scope => "helpers.placeholder").presence
+ placeholder ||= I18n.t("#{object_name}.#{method_and_value}", :default => i18n_default, :scope => "helpers.placeholder").presence
placeholder ||= if object && object.class.respond_to?(:human_attribute_name)
object.class.human_attribute_name(method_and_value)