aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-12-26 23:30:38 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-12-26 23:30:38 -0300
commit42d9b480121e15a15cddd2015a1e60a0f9e0f953 (patch)
treef21fbd85977c9615dcb049247bfc672d12ecf0f6 /actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb
parentceedec7edcadbad824f58e84bc2c1eddbe8539ce (diff)
downloadrails-42d9b480121e15a15cddd2015a1e60a0f9e0f953.tar.gz
rails-42d9b480121e15a15cddd2015a1e60a0f9e0f953.tar.bz2
rails-42d9b480121e15a15cddd2015a1e60a0f9e0f953.zip
Extract the component rendering of collection_radio_buttons and
collection_check_boxes to a private method. It will make easier to extend. Example: class CollectionRadioButtons < ActionView::Helpers::Tags::CollectionRadioButtons include CollectionExtensions def render wrap_rendered_collection(super, @options) end private def render_component(builder) builder.radio_button + builder.label(:class => "collection_radio_buttons") end end
Diffstat (limited to 'actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb')
-rw-r--r--actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb8
1 files changed, 7 insertions, 1 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 45f0bc3d7b..d27df45b5a 100644
--- a/actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb
+++ b/actionpack/lib/action_view/helpers/tags/collection_check_boxes.rb
@@ -21,7 +21,7 @@ module ActionView
if block_given?
yield builder
else
- builder.check_box + builder.label
+ render_component(builder)
end
end
@@ -31,6 +31,12 @@ module ActionView
rendered_collection + hidden
end
+
+ private
+
+ def render_component(builder)
+ builder.check_box + builder.label
+ end
end
end
end