On Friday, February 21, 2014 8:53:20 PM UTC-8, Jeremy Evans wrote:
>
> On Friday, February 21, 2014 3:45:47 PM UTC-8, Kelly Dunn wrote:
>>
>> Thanks for your speedy response.
>>
>> I forgot to mention that all of my original models are inheriting from 
>> Sequel::Model.  After following your advice and loading the json_serializer 
>> directly into Sequel::Model, I came across a different issue; the nested 
>> models (Bar and Baz) were erroring out upon class load, claiming that 
>> json_serializer_opts was nil on this 
>> line<https://github.com/jeremyevans/sequel/blob/master/lib/sequel/plugins/json_serializer.rb#L265>,
>>  
>> which I found odd since the code apparently sets this to an empty hash upon 
>> load.  Curious.  
>>
>> I can resolve this by explicitly stating that each of my models make use 
>> of the json_serializer plugin, but it doesn't solve the symptoms I 
>> mentioned earlier; I'm still getting a weird, stringified variant of what I 
>> would expect.
>>
>> Any pointers on debugging further?  
>>
>
> Please put together a self contained example showing the problem, similar 
> to my original example (setup the tables, setup the models classes, show 
> how it isn't working as you expect).  If you are able to reproduce the 
> problem in a self-contained example, please do post it here and I should be 
> able to figure out what is going wrong.
>
> By any chance are you using active_support?  If so, that is known to cause 
> issues as mentioned in the plugin's documentation.
>

Active support was the culprit in this case; I had a few other gems in my 
project that were installing it as a dependency :\

After extending the Array and hash classes as indicated in your 
documentation<https://github.com/jeremyevans/sequel/blob/d2420b187afb6ad0f5439159997f0851b5aa4834/lib/sequel/plugins/json_serializer.rb#L89>,
 
the JSON serialization appeared to work as intended.  

Apologies for the noise!
 

>
> Thanks,
> Jeremy
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to