Skip to content

Instantly share code, notes, and snippets.

@dougo-chris
Created March 7, 2012 09:05
Show Gist options
  • Save dougo-chris/1992068 to your computer and use it in GitHub Desktop.
Save dougo-chris/1992068 to your computer and use it in GitHub Desktop.
csrf
TEMPLATE
--------
%div{:style => "margin:0;padding:0;display:inline"}
%input{:name => "utf8", :type => "hidden", :value => "✓"}/
%input{:name => "authenticity_token", :type => "hidden", :value => ""}/
%input{:name => "_method", :type => "hidden", :value => "put"}/
VIEW
----
render: ->
$(@el).html(@template())
token = $('meta[name="csrf-token"]').attr('content')
@$('input[name=authenticity_token]').val(token)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment