我正在努力让我的行动回应:html
and :json
。
class GamesController < ApplicationController
respond_to :html, :json
def index
@games = current_user.games
respond_with(@games)
end
end
我去时的预期视图/games
是查看布局,views/games/index.haml
如果我去,/games.json
我应该@games
在浏览器中看到 JSON 数据。
但我所拥有的是,当我去时,/games.json
我看到源代码/games
及其布局等为 Json(application/json
标题中的 HTML 代码)