aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb4
-rw-r--r--actionpack/lib/action_view/helpers/tags/collection_radio_buttons.rb18
2 files changed, 9 insertions, 13 deletions
diff --git a/actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb b/actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb
index d8f7a1fff6..ae27c4e6da 100644
--- a/actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb
+++ b/actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb
@@ -5,9 +5,7 @@ module ActionView
delegate :check_box, :label, :to => :@template_object
def render
- rendered_collection = render_collection(
- @method_name, @collection, @value_method, @text_method, @options, @html_options
- ) do |value, text, default_html_options|
+ rendered_collection = render_collection do |value, text, default_html_options|
default_html_options[:multiple] = true
if block_given?
diff --git a/actionpack/lib/action_view/helpers/tags/collection_radio_buttons.rb b/actionpack/lib/action_view/helpers/tags/collection_radio_buttons.rb
index eea8c41dc0..0b83d3482c 100644
--- a/actionpack/lib/action_view/helpers/tags/collection_radio_buttons.rb
+++ b/actionpack/lib/action_view/helpers/tags/collection_radio_buttons.rb
@@ -5,9 +5,7 @@ module ActionView
delegate :radio_button, :label, :to => :@template_object
def render
- rendered_collection = render_collection(
- @method_name, @collection, @value_method, @text_method, @options, @html_options
- ) do |value, text, default_html_options|
+ rendered_collection = render_collection do |value, text, default_html_options|
if block_given?
yield sanitize_attribute_name(@method_name, value), text, value, default_html_options
else
@@ -50,14 +48,14 @@ module ActionView
"#{attribute}_#{value.to_s.gsub(/\s/, "_").gsub(/[^-\w]/, "").downcase}"
end
- def render_collection(attribute, collection, value_method, text_method, options={}, html_options={}) #:nodoc:
- item_wrapper_tag = options.fetch(:item_wrapper_tag, :span)
- item_wrapper_class = options[:item_wrapper_class]
+ def render_collection #:nodoc:
+ item_wrapper_tag = @options.fetch(:item_wrapper_tag, :span)
+ item_wrapper_class = @options[:item_wrapper_class]
- collection.map do |item|
- value = value_for_collection(item, value_method)
- text = value_for_collection(item, text_method)
- default_html_options = default_html_options_for_collection(item, value, options, html_options)
+ @collection.map do |item|
+ value = value_for_collection(item, @value_method)
+ text = value_for_collection(item, @text_method)
+ default_html_options = default_html_options_for_collection(item, value, @options, @html_options)
rendered_item = yield value, text, default_html_options