Skip to content

Instantly share code, notes, and snippets.

@leejarvis
Forked from siassaj/_form.rb
Last active December 21, 2015 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leejarvis/6327722 to your computer and use it in GitHub Desktop.
Save leejarvis/6327722 to your computer and use it in GitHub Desktop.
= simple_form_for @machine_visit_form do |f|
= f.error_notification
= f.input :refill_id, as: :hidden
= f.input :refill_date, as: :date
= f.input :refill_counter, as: :decimal, input_html: {value: number_with_precision(f.object.refill_counter, precision: 2) }
= f.fields_for :refill_line_items do |ff|
.well
= "#{ff.object.product_name}"
= ff.select :product, options_from_collection_for_select(Product.all, "id", "name")
= ff.number_field :quantity
<div class="well">
No Product<input id="refill_refill_line_item_id" name=
"refill[refill_line_item][id]" type="hidden" /><select id=
"refill_refill_line_item_product" name="refill[refill_line_item][product]">
<option value="1">
Mars Bar
</option>
</select><input id="refill_refill_line_item_quantity" name=
"refill[refill_line_item][quantity]" type="number" />
</div>
<div class="well">
No Product<input id="refill_refill_line_item_id" name=
"refill[refill_line_item][id]" type="hidden" /><select id=
"refill_refill_line_item_product" name="refill[refill_line_item][product]">
<option value="1">
Mars Bar
</option>
</select><input id="refill_refill_line_item_quantity" name=
"refill[refill_line_item][quantity]" type="number" />
</div>
<div class="well">
No Product<input id="refill_refill_line_item_id" name=
"refill[refill_line_item][id]" type="hidden" /><select id=
"refill_refill_line_item_product" name="refill[refill_line_item][product]">
<option value="1">
Mars Bar
</option>
</select><input id="refill_refill_line_item_quantity" name=
"refill[refill_line_item][quantity]" type="number" />
</div><input class="btn btn-primary" name="commit" type="submit" value=
"Create Refill" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment