Form_tag question


#1

I have an invoicing index page, with a table of invoices to be processed. So, basically, I need 1 field I’d like to update [for each record that needs to be processed]. I have the following form in one of the table details…

 <%= form_tag invoicing_path do %>
                <%= text_field_tag :invoice %>
                <%= submit_tag "Save" %>
              <% end %>

No route matches {:action=>"update", :controller=>"invoicing"} missing required keys: [:id]

but I can’t seem to figure out how to pass the id into this form?

any suggestions?


#2

If you are updating an invoice, you must pass your id on the route, it would be good if you show your route here to update, but this should work

 <%= form_tag invoicing_path(@invoice) do %>
                <%= text_field_tag :invoice %>
                <%= submit_tag "Save" %>
              <% end %>