ActiveResource with Json

Hi all. I’m hoping maybe someone can help me out.

I recently switched from using xml to json in my ARe models. I was
excited to see that in irb I was seeing dramatic improvements in
speed. However, when I fired up the app in my browser I got an error
on a local db find based upon an id i had intended to receive through an
ARe record. I opened irb again to investigate:

object = AResource.find(461).id

the ARe record is found, however the id attribute returns as nil,
where as, when I was using xml, I had no problems with it.

(the reaons i’m doing the find(id).id is to demonstrate that the
record returned does not have the id which i used to search for the
record. All other attributes are present, however, the object is also
showing new_record=true, which i’m supposing is the reason it has a
nil id)

Any thoughts on what I can do maintain that id? The only thing I can
come up with is that i have a local model name that is the same as the
object class that is returned from the remote application, though, like
I
said, there was no problem when using xml.

The following is from irb (object1 is the xml request and object2 is
the json request–both point to the same resource)

Code :

object1 = MMTest.find(1)
=> #<MMTest:0x4058328 @prefix_options={}, @attributes={“name”=>“Visa”,
“updated_at”=>nil, “id”=>1, “status”=>1}>

object2 = MMCreditcardType.find(1)
=> #<MMCreditcardType:0x404c4c4 @prefix_options={}, @attributes=
{“creditcard_type”=>#<CreditcardType id: nil, name: “Visa”, status:
true, created_at: nil, updated_at: nil>}>

Thanks in advance,

~Steve