我正在使用gem"jbuilder_cache_multi"缓存json响应。当我从我的ios原生应用程序中访问api时,我遇到了一个奇怪的错误。下面是我得到的错误:
ActionView::Template::Error (singleton can't be dumped):
2:
3: json.orders do
4: json.cache! ['v1', I18n.locale, @orders] do
5: json.cache_collection! @orders, key: ['v1', I18n.locale] do |order|
6: json.partial! 'order', order: order
7: end
8: end
app/views/api/v1/orders/index.json.jbuilder:5:in `block (2 levels) in
请求是:
Started GET "/api/v1/orders?page=2&q%5Bmerchant_id_eq%5D=1&q%5Bs%5D=created_at+asc&q%5Bstate_not_in%5D%5B%5D=composing&q%5Bstate_not_in%5D%5B%5D=distributed&q%5Bstate_not_in%5D%5B%5D=canceled"
在这方面有人能帮忙吗。感谢
您返回的字段之一可能是nil
。您需要to_s
。请检查值。