Order has_many jobs
Job belongs to order
我想編輯的@job.order
屬性:通過輸入表單編輯關聯模型?
<% order = @job.order %>
<%= simple_form_for [@job, order],
url: job_path(@job),
method: :put,
remote: true do |f| %>
<%= f.input :order_status, input_html: {class: 'form-control'} %>
(...)
<% end %>
任何方式只是用簡單的形式輸入辦呢?
http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods .html –