Skip to content

Instantly share code, notes, and snippets.

@matatabi
Created July 4, 2011 04:01
Show Gist options
  • Save matatabi/1062902 to your computer and use it in GitHub Desktop.
Save matatabi/1062902 to your computer and use it in GitHub Desktop.
multiple checkboxes
serialize :product_categories
<%= select_product_categories(@vendor.registration_request.product_categories) %>
def select_product_categories(array)
if array == nil or array.length == 0
array = []
end
html = ""
for pc in PRODUCT_CATEGORIES_JP
html << "<div class='fixed_cell'>#{check_box_tag 'vendor[registration_request_attributes][product_categories][]', pc, array.include?(pc)}&nbsp;#{pc}</div>"
end
return raw html
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment