我的控制器中有以下代码:
def tljson (result = [])
@stat_id = params[:stat_id]
@rpm = FedoraRpm.find_by_name(@stat_id)
@rpm.ruby_gem.historical_gems.each { |h|
result << { :content => h.version, :start => h.build_date }
}
@rpm.bugs.each { |b|
result << { :content => b.name + "<br><a href='"+b.url+"'>View on BugZilla</a>", :start => b.bz_id }
}
@res = result.to_json
respond_to do |format|
format.json { render @res.to_json }
end
end
转到 /tljson.json 会呈现 JSON,但标题显示“缺少模板;缺少模板'。我究竟做错了什么?