Rails Rails Content Negotiation 的奇怪问题

ShiningRay · 2012年06月10日 · 最后由 ShiningRay 回复于 2012年06月10日 · 2601 次阅读

有没有这种可能性,即使在 url 中已经指定了 params[:format],如

/articles/1/comments.json

但是依然返回的 HTML 结果

目前开发中发现有时候这个路径缓存的会是 html 结果,导致 ajax 请求失败,所以想请教一下高手

环境是 Rails 2.3.14,respond_to 块中有 html 和 json

把 format 加到 cache key 里面

#1 楼 @hooopo /articles/1/comments.json 我直接用的这个,里面不是已经有 format 了么

需要 登录 后方可回复, 如果你还没有账号请 注册新账号