<%= [email protected], :url => equipments_path, :method => :post do |f| %>
....
<% if @equipment.id.present? %>
<div class="actions">
//TODO submit_tag to action Update
</div>
<% else %>
<div class="actions">
<%= submit_tag "Adicionar Equipamento" %>
</div>
<% end %>
<% end %>
이 예제에서는 두 개의 버튼이 있습니다. 객체가있는 경우 첫 번째 버튼이 있고 두 번째 버튼이없는 경우 두 번째 버튼이 있습니다. 두 번째 버튼은 컨트롤러 Equipment # Create에 요청을 보냅니다. 첫 번째 버튼으로 장비 # 업데이트로 요청을 보내려면 어떻게해야합니까?레일 다른 작업에 submit_tags
<% = simple_form_for @equipment do | f | %>이 행은 객체가 새로운 것인지 아닌지를 확인하여 생성 또는 업데이트 경로를 자동으로 처리합니다. – user100693