ActionView::Helpers::CsrfHelper

Alias: csrf_meta_tag

def csrf_meta_tags()

Description

Creates the <meta> tags for the CSRF token.

Creates these two <meta> tags:
  • csrf-param: its content is the name of the parameter that holds the token (authenticity_token).
  • csrf-token: its content is the token for this session, which JavaScript reads to add to its request headers.
In a controller with CSRF protection turned off (protect_against_forgery? is false), nothing is created.

ERB

Changes from the previous output: Added Removed Changed


          

HTML