Skip to content

Instantly share code, notes, and snippets.

@bryckbost
Forked from danielmorrison/csrf_helper.rb
Created February 26, 2011 19:17
Show Gist options
  • Save bryckbost/845516 to your computer and use it in GitHub Desktop.
Save bryckbost/845516 to your computer and use it in GitHub Desktop.
def csrf_meta_tags
if protect_against_forgery?
[].tap do |tags|
tags << tag('meta', {:name => 'csrf-param', :content => request_forgery_protection_token})
tags << tag('meta', {:name => 'csrf-token', :content => form_authenticity_token})
end.join("\n").html_safe
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment