开发者

BackboneJS and Rails 3 - Sync problems with $.ajax

I'm having trouble getting BackboneJS's syncing to work with my rails3 backend. I'm trying to use the JSON posts, and it sends my data in {_json: {}}. The problem with this is that the authenticity_token is then not included. (Or perhaps it is, but in the _json parameter). Rails won't deserialize it, even though I've forced the ajax options: {开发者_如何学GocontentType: 'application/json', dataType: "json"}.

Any suggestions?


Check out this adapter that incorporates Rails' authenticity token:

https://github.com/Maciek416/BackboneRailsAuthTokenAdapter

Source: Ed Schmalzle on the Philly.rb mailing list


Have you tried a before_filter that pulls the token out of request.parameters and sets it in the params hash?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜