Ruby Rails接受\u嵌套的\u属性不起作用
我已将以下表格的相关部分包括在内:Ruby Rails接受\u嵌套的\u属性不起作用,ruby,ruby-on-rails-3,activerecord,Ruby,Ruby On Rails 3,Activerecord,我已将以下表格的相关部分包括在内: ActiveRecord::RecordNotFound in InvoicesController#create Couldn't find LineItem with ID=21 for Invoice with ID= show InvoicesController#createAndInvoicesController#new。在new视图中添加您的表单。@fl00r、@AndrewMarshall InvoiceController#creat
ActiveRecord::RecordNotFound in InvoicesController#create
Couldn't find LineItem with ID=21 for Invoice with ID=
show InvoicesController#createAndInvoicesController#new
。在new
视图中添加您的表单。@fl00r、@AndrewMarshall InvoiceController#create、InvoiceController#new和新视图中添加了有关预填充
的内容?问题是,您正在将exist line_items设置为non exist invoiceFound my answer,因为您必须在create操作中更新_属性之前进行关联。ActiveRecord关联API文档()
ActiveRecord::RecordNotFound in InvoicesController#create
Couldn't find LineItem with ID=21 for Invoice with ID=
<% f.fields_for :line_items do |li| %>
<%= li.text_field :description %>
<%= li.text_field :amount %>
<% end %>