I’m using the simple_form gem in rails 3.2.2 and am trying to set up checboxes for a HABTM association.
A Monitoring has and belongs to many Scenarios and vica versa.
Using simple form, I can output a set of checkboxes automatically using:
= f.association :scenarios, as: :check_boxes
This produces the following output:
<div class="checkbox">
<label class="checkbox">
<div class="ui-checkbox">
<input class="check_boxes optional" id="monitoring_scenario_ids_1" name="monitoring[scenario_ids][]" type="checkbox" value="1">
</div>
Haraam Meat Found</label>
<input name="monitoring[scenario_ids][]" type="hidden" value="">
</div>
However, jQuery Mobile will only style and recognise it if it is in the following format:
<input type="checkbox" name="checkbox-1" id="checkbox-0" class="custom" />
<label for="checkbox-0">I agree</label>
Anyone know how to do this?
Change the
config.boolean_stylefrom:nestedto:inlinein your config/initializers/simple_form.rb as you can see in these line https://github.com/plataformatec/simple_form/blob/master/lib/generators/simple_form/templates/config/initializers/simple_form.rb.tt#L94-98