Skip to content

Instantly share code, notes, and snippets.

@jhuckabee
Last active August 29, 2015 14:06
Show Gist options
  • Save jhuckabee/810552e99959eacbbea9 to your computer and use it in GitHub Desktop.
Save jhuckabee/810552e99959eacbbea9 to your computer and use it in GitHub Desktop.
rails-ajax.html
<polymer-element name="rails-ajax" extends="core-ajax">
<script>
Polymer({
ready: function() {
this.super();
this.csrfParam = document.querySelector("meta[name=csrf-param]").content;
this.csrfToken = document.querySelector("meta[name=csrf-token]").content;
},
getParams: function(params) {
params = this.super(params);
params[this.csrfParam] = this.csrfToken;
return params;
}
});
</script>
</polymer-element>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment