3
我正在嘗試使用query_reviewer gem來分析mysql查詢。似乎訪問輸出的唯一方法是將結果注入視圖。我的Rails應用程序只有返回JSON並沒有意見。Rails - 使用帶有JSON Web服務的query_reviewer
是否有替代方法來查看數據?
我正在嘗試使用query_reviewer gem來分析mysql查詢。似乎訪問輸出的唯一方法是將結果注入視圖。我的Rails應用程序只有返回JSON並沒有意見。Rails - 使用帶有JSON Web服務的query_reviewer
是否有替代方法來查看數據?
我從來沒有用過寶石,但它的documentation解釋了一個功能來配置它到而不是寫輸出到一個視圖。
在config/query_reviewer.yml
:
inject_view: false
如果是,使JSON的一部分,則使用query_review_output
幫手;最好逃避到JSON:query_review_output.to_json
。這將在生成JSON的視圖中進行。如果您沒有它,請考慮將其添加到控制器中的JSON輸出:
def show
@my_current_model = MyCurrentModel.find(params[:id])
@output = @my_current_model.to_json
@output.merge!({query_review_output: query_review_output })
render json: @output
end
您想如何分析mysql查詢? – MZaragoza
將結果記錄到另一個日誌文件中 – darkphantum