Skip to content

Instantly share code, notes, and snippets.

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