0
我使用的鐵軌2.3.5,1.9.3紅寶石路過XML時,大量分配這些屬性的保護,RubyGems的1.8.24和Mac OS X獅子警告:不能使用捲曲
我傳遞這個文件中,「invoice.xml.erb」使用捲曲:
<invoice>
....
<invoice_detail>
....
</invoice_detail>
</invoice>
我期待有發票領域的填補,也invoice_details的領域,但是當我通過捲曲的命令,只是發票領域正在填充,並且發生此錯誤:警告:無法批量分配這些受保護的屬性:inventoryDocId,invoice_detail
這裏是我的模型:
invoice.rb
class Invoice < ActiveRecord::Base
set_table_name "inventoryDocHeader"
set_primary_key "inventoryDocId"
has_many :invoice_detail, :foreign_key => "inventoryDocId"
attr_accessible :inventoryDocId, :originDocId, :siteCode, :transCode, :typeCode, :docCode, :partyTerms,:locationCode, :otherCharges, :grossPrice, :netPrice, :amountPaid, :amountPending, :amountReturned, :RSiteCode, :RInventoryDocId, :RDocCode, :ROriginDocId, :batchCode, :partyCharges, :partyShipmentTermsText, :estimateVolume, :originCountryId, :consigneeName, :consigneeAddress1, :consigneeAddress2, :consigneeAddress3, :notifyPartyName, :notifyPartyAddress1, :notifyPartyAddress2, :notifyPartyAddress3
end
invoice_detail.rb
class InvoiceDetail < ActiveRecord::Base
set_table_name "inventoryDocDetail"
belongs_to :invoice, :foreign_key => "inventoryDocId"
attr_accessible :inventoryDocId, :lineNumber, :parentLineNumber, :productCode, :actualQuantity, :unitCode, :contentQuantity, :cost, :price, :commission, :factorRate, :referenceLineNumber
end
任何建議都歡迎。謝謝!
我從invoice_detail中得到它,因爲發票字段全部填滿。 –
然後我會嘗試添加'invoice_attributes'到attr_accessible InvoiceDetail模型 –