2010-03-15 83 views
0
遇到問題拉數據

所以這裏的inspect一類的輸出:紅寶石:從這個類

<Recurly::BillingInfo::CreditCard:0x1036a8a98 @prefix_options={}, @attributes={"month"=>1, "last_four"=>"1", "type"=>"bogus", "year"=>2010}> 

我試圖讓type屬性,但目前看來,可能是某種形式的保留字?

這裏是我想要做的

@charges = Recurly::BillingInfo.find('123') 
@charges.credit_card.type 

所以完全破敗,我怎樣才能從type

回答

2

試試這個,看看有什麼方法可供你:

@charges.credit_card.methods 

無論如何,我認爲這應該爲你工作:

@charges.credit_card.attributes['type'] 
+0

完美。謝謝! – Shpigford 2010-03-15 04:11:01

2

在ActiveRecord的「類型」爲屬性留作單我相信表繼承關聯。

您可能需要別名,或在遷移中創建「card_type」屬性而不是「type」屬性。