2013-05-29 43 views

回答

0

我從來沒有用過寶石,但它的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