开发中碰到了这样的一个错误:
wrong argument type JSON::Pure::Generator::State (expected Data)
参考http://pastebin.com/cvxJKAtE
解决方法如下:
在config/initializers下新建一文件json_patch.rb,编写如下内容
class Fixnum
def to_json(options = nil)
to_s
end
end
wrong argument type JSON::Pure::Generator::State (expected Data)
参考http://pastebin.com/cvxJKAtE
解决方法如下:
在config/initializers下新建一文件json_patch.rb,编写如下内容
class Fixnum
def to_json(options = nil)
to_s
end
end
本文介绍了一个关于JSON生成的错误:wrongargumenttypeJSON::Pure::Generator::State(expectedData)及其解决方案。通过在config/initializers目录下创建名为json_patch.rb的文件,并在其中定义Fixnum类的to_json方法,可以解决该问题。
11万+

被折叠的 条评论
为什么被折叠?



