0
我有一個簡單的Rails 3.2控制器,其被消耗與JSON一個API:導軌3個respond_with返回協會
module Api
module V1
class ReportsController < Api::V1::ApplicationController
def index
respond_with Report.where(name: params[:name])
end
end
end
end
(沒有代碼是父控制器)
當我消耗此方法,我正在按預期收回所有報告,但我也獲得了所有的關聯。我不明白這是爲什麼,並想阻止它。
爲什麼我得到這些關聯?
你如何生成你的JSON? –
也許你在你的應用程序中有序列化程序的寶石,我知道它們被用來獲得與關聯的JSON響應。 – rmagnum2002
@ZachKemp JSON剛剛通過Rails與'responds_with:json' –