Created
December 14, 2012 09:48
-
-
Save leepfrog/4284160 to your computer and use it in GitHub Desktop.
#EmberJS - Adding support for CSRF from Rails to your Adapter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.Adapter = DS.RESTAdapter.extend | |
# Add CSRF Token from Rails to non-get requests | |
ajax: (url, type, hash) -> | |
if hash.data and type isnt "GET" | |
hash.data['authenticity_token'] = jQuery("meta[name='csrf-token']").attr("content") | |
@_super(url,type,hash) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment