Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

checked option should override existing associations, closes #241

  • Loading branch information...
commit 851a404b3e6d7fd72a3e1f697961c15f30fd882d 1 parent 54acfe7
@nashby authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/simple_form/action_view_extensions/builder.rb
View
4 lib/simple_form/action_view_extensions/builder.rb
@@ -70,7 +70,7 @@ def collection_radio(attribute, collection, value_method, text_method, options={
# Collection check box accepts some extra options:
#
# * checked => the value or values that should be checked initially. Accepts
- # a single item or an array of items.
+ # a single item or an array of items. It overrides existing associations.
#
# * disabled => the value or values that should be disabled. Accepts a single
# item or an array of items.
@@ -86,7 +86,7 @@ def collection_check_boxes(attribute, collection, value_method, text_method, opt
attribute, collection, value_method, text_method, options, html_options
) do |value, text, default_html_options|
default_html_options[:multiple] = true
-
+ default_html_options[:checked] = !!default_html_options[:checked] if options.has_key?(:checked)
check_box(attribute, default_html_options, value, '') +
label(sanitize_attribute_name(attribute, value), text, :class => "collection_check_boxes")
end
Please sign in to comment.
Something went wrong with that request. Please try again.