开发者

undefined method `encode' for ActiveSupport::JSON:Module

I am getting this error pretty regularly, but it also seems to be pretty randomly.

C:/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/lib/active_support/core_ext/object/to_json.rb:20:in `to_json'

This is occurring sporadically when calling to_json on a hash, for example:

{:@i=>18}.to_json

Anyone run across this before? It's strange and can't fin开发者_高级运维d much on the internets related.


I get this when using threads (but I'm not using activerecord but SimpleRecord (amazon's db). Solution is to use .to_json first without threads:

MyFantasticModel.first.to_json 
# and then run the threaded stuff
@threads << Thread.new {...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜