私のrailsアプリには、Item
多くのモデルがありますVersions
。私のコントローラーにはversions
アクションがあります。
def versions
@item = Item.find(params[:id])
respond_to do |format|
format.json { render json: @item.versions }
end
end
バージョンをリクエストするたびに、正常に返されるアイテムと返さないアイテムがあります。しかし、コンソールに入ると、すべてのアイテムのバージョンを問題なく取得できます。
成功(バージョンのJSON配列を返します):
Started GET "/api/versions/4.json?"
Processing by ItemsController#versions as JSON
Parameters: {"id"=>"4"}
Completed 200 OK in 106ms (Views: 0.1ms | ActiveRecord: 19.8ms)
app[web.1]: cache: [GET /api/versions/4.json?] miss
heroku[router]: GET x.x.com/api/versions/4.json? dyno=web.1 queue=0 wait=0ms service=113ms status=200 bytes=831
失敗しました(ステータス200、JSONデータなしの2つの応答を返します):
Started GET "/api/versions/1.json?"
Processing by ItemsController#versions as JSON
Parameters: {"id"=>"1"}
Completed 200 OK in 249ms (Views: 0.1ms | ActiveRecord: 162.9ms)
app[web.1]: cache: [GET /api/versions/1.json?] miss
heroku[router]: GET x.x.com/api/versions/1.json? dyno=web.1 queue=0 wait=0ms service=257ms status=200 bytes=3540
これを引き起こす可能性のあるアイデアはありますか?HerokuでSQLをログに記録する方法がわからないので、アイデアがありません。