Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby Rails接受\u嵌套的\u属性不起作用_Ruby_Ruby On Rails 3_Activerecord - Fatal编程技术网

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#createAnd
InvoicesController#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 %>