:html
및 :json
에 대한 작업을 수행하려고합니다.Rails 3.1에서`respond_with` 및`respond_to`에 대한 예상치 못한 동작이 발생했습니다.
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
에 가면 내가 가지고있는이 broswer에서 JSON 데이터로 @games
을 볼 수 있습니다. 내가 함께 /games
의 소스 코드를 볼 수 /games.json
에 갈 때
는하지만 내가 가진 것은 자사의 레이아웃 등 JSON (당신은 파일의 확장자에에 havve 헤더 "
를 통해 오타'@players = current_user.games' 내 응용 프로그램에서 여기 @games = current_user.games' – fl00r
오타하지'해야 ! (수정) – amrnt
보기/게임/index.haml해야합니다. be views/games/index.html.haml 난 그냥 erb를 사용하는 응용 프로그램과 이것을 확인하고 잘 작동 ... 당신은 이전 버전의 레일 시도 했습니까? – Gazler