tags:

views:

39

answers:

2

So here's the output of inspect on a class:

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

I'm trying to get the type attribute but seems that might be some sort of reserved word?

Here's the full rundown of what I'm trying to do

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

So, how can I get type from that?

+2  A: 

Try this to see what methods are available to you:

@charges.credit_card.methods

Anyway I believe this should work for you:

@charges.credit_card.attributes['type']
khelll
Perfect. Thanks!
Shpigford
+2  A: 

In ActiveRecord "type" as an attribute is reserved for Single Table Inheritance associations I believe.

You may need to alias the name, or create a "card_type" attribute in your migration rather than a "type" attribute.

scaney