Rails Completed 406不可接受 [英] Rails Completed 406 Not Acceptable

查看:131
本文介绍了Rails Completed 406不可接受的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道这里到底发生了什么,我刚刚将Rails从3.1.0rc4更新到了3.1.0,突然发现所有的ajax无法正常工作,一直导致406错误.在我更新到3.1.0之前,一切都很好

I don't know what the heck is going on here, I just updated my rails from 3.1.0rc4 to 3.1.0 and I suddenly find that all ajax won't work, It's causing 406 error all the time. Everything was perfectly fine before I update to 3.1.0

伙计们,我现在会失去控制力,请帮助我.

Guys, I am going to lose controll now, help me.

推荐答案

请确保您设置了正确的内容类型,并且您的控制器响应了指定的格式.如果请求内容类型设置为"application/json",并且您的控制器在操作中没有声明response_to:json或format.json响应,则经常会发生这种情况.

Make sure that you're setting the correct content-type and that your controllers respond to the specified format. This often happens if the request content-type is set to 'application/json' and your controller doesn't have either respond_to :json declared or a format.json response in your action.

这篇关于Rails Completed 406不可接受的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆