Avoid key symbolization for ActiveResource

I am using an ActiveResource model called Configure to connect to an external web service that provides some response, as in the following example:

{"setting" => {"id" => 10, :details => {"10a" => 7, "10b" => 8}}}

The problem is that ActiveResource tries to symbolize all the keys in the hash details, but this is impossible and calls NameError: wrong constant name 10a. Is there a chance to prohibit symbolism or even avoid conversion detailsto a separate object?

thank

+5
source share
2 answers

Did you try to configure your circuit manually? I do not know if you can set nested attributes like this.

class Setting < ActiveResource::Base
   schema = {'setting' => {'id' => :integer, :details => {'10a' => :integer, '10b' => :integer}}}
end
0
source

, - HashWithIndifferentAccess? #deep_stringify_keys , ?

0

All Articles