mercredi 18 novembre 2015

How to delete the last element from ruby association input

How to delete the last element from ruby association input

this is my input form field, which select all sizes and lists

= simple_nested_form_for [:admin, @product], wrapper: :horizontal_small_form do |f| = f.association :standard_sizes, as: :check_boxes

This is what iam getting when iam inspecting it. How to remove last option (custom size) from this.

<label class="check_boxes optional control-label">Standard sizes</label><span class="checkbox"><label for="product_standard_size_ids_1"> <input class="check_boxes optional" type="checkbox" value="1" name="product[standard_size_ids][]" id="product_standard_size_ids_1">S</label></span><span class="checkbox"><label for="product_standard_size_ids_2"> <input class="check_boxes optional" type="checkbox" value="2" name="product[standard_size_ids][]" id="product_standard_size_ids_2">M</label></span><span class="checkbox"><label for="product_standard_size_ids_3"> <input class="check_boxes optional" type="checkbox" value="3" name="product[standard_size_ids][]" id="product_standard_size_ids_3">L</label></span><span class="checkbox"><label for="product_standard_size_ids_4"> <input class="check_boxes optional" type="checkbox" value="4" name="product[standard_size_ids][]" id="product_standard_size_ids_4">XL</label></span><span class="checkbox"><label for="product_standard_size_ids_5"> <input class="check_boxes optional" type="checkbox" value="10" name="product[standard_size_ids][]" id="product_standard_size_ids_10">Custom Size</label></span><input type="hidden" name="product[standard_size_ids][]" value=""></div>




Aucun commentaire:

Enregistrer un commentaire