diff options
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/form_tag_helper.rb | 9 |
2 files changed, 6 insertions, 9 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 557f8454be..932e9e2f95 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -576,12 +576,12 @@ module ActionView # label(:post, :terms) do # 'Accept <a href="/terms">Terms</a>.' # end - def label(object_name, method, content_or_options_with_block = nil, options = nil, &block) + def label(object_name, method, content_or_options = nil, options = nil, &block) if block_given? - options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash) + options = content_or_options if content_or_options.is_a?(Hash) text = nil else - text = content_or_options_with_block + text = content_or_options end options ||= {} diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 9d15805d46..2a3f826c15 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -156,15 +156,12 @@ module ActionView # # label_tag 'name', nil, :class => 'small_label' # # => <label for="name" class="small_label">Name</label> - def label_tag(name = nil, content_or_options_with_block = nil, options = nil, &block) - if block_given? - options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash) - end - + def label_tag(name = nil, content_or_options = nil, options = nil, &block) + options = content_or_options if block_given? && content_or_options.is_a?(Hash) options ||= {} options.stringify_keys! options["for"] = sanitize_to_id(name) unless name.blank? || options.has_key?("for") - content_tag :label, content_or_options_with_block || name.to_s.humanize, options, &block + content_tag :label, content_or_options || name.to_s.humanize, options, &block end # Creates a hidden form input field used to transmit data that would be lost due to HTTP's statelessness or |