Skip to content

Instantly share code, notes, and snippets.

@danielmorrison
Created February 26, 2011 18:36
Show Gist options
  • Save danielmorrison/845475 to your computer and use it in GitHub Desktop.
Save danielmorrison/845475 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