0
在軌控制檯,我運行此命令工廠女孩嵌套屬性
bill = Bill.last
bill.bill_extras
結果就是這樣。
[#<BillExtra id: 141, bill_id: 621, content: "extra fee", prize: #<BigDecimal:7fa2e37d4f50,'0.248E3',9(18)>, created_at: "2012-08-02 04:48:12", updated_at: "2012-08-02 04:50:41">]
在規範文件,
require 'spec_helper'
require 'pry'
describe Bill do
before(:all) do
@project=Factory(:project_started)
@customer_bill=Factory(:customer_invoice, :project => @project)
@creavite_bill=Factory(:creative_invoice, :project => @project)
@bill_extra=Factory.build(:bill_extra, :bill => @customer_bill)
end
binding.pry
end
當我調試,運行在撬這些命令,
@customer_bill.bill_extras
這將是一個空數組。