Creating new table entry when updating another entry of another table - Ruby on Rails
- by Michaël
Hi,
I have written this code in my "show" view of estimates and I want that, when submitting (update), it creates a new repairs (Repair.new(???)) with some parameters. I don't know where to write the "new repairs" code, in this view or the controller (in update part).
I need that the Repair is created one time, not each time the @estimate is updated.
<% form_for @estimate, :url => {:controller => "estimates", :action => "update"} do |f| %>
<%= f.error_messages %>
<select id="estimate_accept" name="estimate[accept]">
<option value="1" selected="selected">accept</option>
<option value="2">refuse</option>
</select>
<%= f.submit "Update" %>
<% end %>
Thank you for your help, I hope my explanations are clear!