コントローラーにこれがあります:
class TeamsController < ApplicationController
respond_to :json
def index
@teams = Teams.all
respond_with @teams
end
def show
@team = Teams.find params[:id]
respond_with @team
end
これは私の見解がどのように見えるかです:
<%= render partial: "team", object: @team %> #file-show.json.erb
[<%= render partial: "team", collection: @teams, spacer_template: "comma" %>] #file-index.json.erb
<%= @team.to_json.html_safe %> #file- _team.json.erb
しかし、teams.json の応答は常に [null, null, null] ですが、teams/1.json の応答は正しい {"id"...} です。何が間違っているのでしょうか?