dimanche 13 septembre 2015

Formtastic pre-check few checkboxes

I'm trying to manually tell formtastic to check a few checkboxes. @some_array currently has an element called checked which exists for each member.

= f.input :cboxes, label: "CBoxes", as: :check_boxes, 
    collection: @some_array.map { |a| [a[:name], a[:id]] }

I've tried to set the input_html to { checked: 'checked' } (How to pre-check checkboxes in formtastic) but this checks all checkboxes, not just the select few that I want.

The contents of @some_array are coming via an API, and I can't change the database structure (Ruby on Rails + Formtastic: Not checking checkboxes for multiple checked answers)

Suggestions?




Aucun commentaire:

Enregistrer un commentaire