aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view
diff options
context:
space:
mode:
authorVasiliy Ermolovich <younash@gmail.com>2013-10-27 18:14:16 +0300
committerVasiliy Ermolovich <younash@gmail.com>2013-10-27 18:31:19 +0300
commit106c988c10c29332343d8de5719a8b045d093753 (patch)
tree8b0083253b0af4282036b9136dc587bcfd3cf3d9 /actionview/lib/action_view
parent094e31ce6700993759c6f36db52afb0a43bfa71f (diff)
downloadrails-106c988c10c29332343d8de5719a8b045d093753.tar.gz
rails-106c988c10c29332343d8de5719a8b045d093753.tar.bz2
rails-106c988c10c29332343d8de5719a8b045d093753.zip
add include_hidden option to collection_check_boxes helper
Diffstat (limited to 'actionview/lib/action_view')
-rw-r--r--actionview/lib/action_view/helpers/tags/collection_check_boxes.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb b/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb
index 9b77ebeb1b..8b28e4fc33 100644
--- a/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb
+++ b/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb
@@ -27,10 +27,14 @@ module ActionView
# Append a hidden field to make sure something will be sent back to the
# server if all check boxes are unchecked.
- hidden_name = @html_options[:name] || "#{tag_name}[]"
- hidden = @template_object.hidden_field_tag(hidden_name, "", :id => nil)
+ if @options.fetch(:include_hidden, true)
+ hidden_name = @html_options[:name] || "#{tag_name}[]"
+ hidden = @template_object.hidden_field_tag(hidden_name, "", :id => nil)
- rendered_collection + hidden
+ rendered_collection + hidden
+ else
+ rendered_collection
+ end
end
private