diff options
author | Alex Robbin <alex.robbin@meyouhealth.com> | 2014-08-22 09:54:54 -0400 |
---|---|---|
committer | Alex Robbin <alex.robbin@meyouhealth.com> | 2014-08-22 09:54:54 -0400 |
commit | f99e62e2d9e010102788f1e728f54b03f65115c5 (patch) | |
tree | ce685faa97a2b369c7c5e0a875fe93b9413fc784 /actionview/lib | |
parent | fea7fe1fd2c7dbd98cf8707f9ecd17d010777fc1 (diff) | |
download | rails-f99e62e2d9e010102788f1e728f54b03f65115c5.tar.gz rails-f99e62e2d9e010102788f1e728f54b03f65115c5.tar.bz2 rails-f99e62e2d9e010102788f1e728f54b03f65115c5.zip |
just use the placeholder tag value if it is passed as a String
Diffstat (limited to 'actionview/lib')
-rw-r--r-- | actionview/lib/action_view/helpers/tags/placeholderable.rb | 4 |
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) |