I m trying to make my actions respond to :html
and :json
.
class GamesController < ApplicationController
respond_to :html, :json
def index
@games = current_user.games
respond_with(@games)
end
end
The expected view when I go to /games
is to see the layout of views/games/index.haml
and if I go to /games.json
I should have see the @games
as JSON data in the broswer.
But what I have is, when I go to /games.json
I see the source code of /games
with its layout etc as Json (HTML code with application/json
in the header"