On Wednesday, September 12, 2018 at 10:17:12 PM UTC-7, 
[email protected] wrote:
>
> Hey, I have a Sinatra project where several queries are returning results 
> using the to_json helper.
> It seems that the returned body is changing at some point causing errors...
> redeploying will get it working again, but after some time it will fail 
> again..
> The json plugin is activated globally with "Sequel::Model.plugin 
> :json_serializer"
>
> HourlyPunch.where( :customer_id => custy_id ).order_by( :starttime 
> ).to_json
>
> returns the following under normal conditions:
>
>
> [{"id":11,"customer_id":1,"staff_id":null,"hourly_task_id":1,"starttime":"2018-09-08T21:50:51-04:00","endtime":"2018-09-09T01:10:34-04:00"},{"id":12,"customer_id":1,"staff_id":null,"hourly_task_id":1,"starttime":"2018-09-09T01:15:17-04:00","endtime":"2018-09-09T01:58:59-04:00"}]
>
> but then starts returning the following after some unknown change:
>
>
> [{"json":"{\"id\":13,\"customer_id\":693,\"staff_id\":null,\":1,\"starttime\":\"2018-09-09T09:18:26.254-04:00\",\"endtime\":\"2018-09-09T14:02:10.821-04:00\"}"},{"json":"{\"id\":14,\"customer_id\":693,\"staff_id\":null,\"hourly_task_id\":1,\"starttime\":\"2018-09-09T14:02:25.168-04:00\",\"endtime\":\"2018-09-09T14:02:31.131-04:00\"}"}]
>
> It seems like it doesn't whether to apply the to_json to each object of 
> the array or to the whole result and switches back and forth..
> I have at least one other query on a completely different model that seems 
> to break in step with this one as well so it seems like something affecting 
> the whole system.
> any ideas what could be causing this?
>

At some point, is the active_support json code being loaded?  Because that 
breaks things, as documented in the json_serializer man page.  If that 
isn't it, please put together a minimal self-contained reproducible example 
and I will review.

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 https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to