Class: Brut::FrontEnd::Components::Inputs::CsrfToken
- Inherits:
-
Brut::FrontEnd::Components::Input
- Object
- Phlex::HTML
- Brut::FrontEnd::Component
- Brut::FrontEnd::Components::Input
- Brut::FrontEnd::Components::Inputs::CsrfToken
- Defined in:
- lib/brut/front_end/components/inputs/csrf_token.rb
Overview
Renders a hidden field for a form that contains the current CSRF token. You only need to use this directly if you are building a form without FormTag
Instance Method Summary collapse
-
#initialize(csrf_token:) ⇒ CsrfToken
constructor
A new instance of CsrfToken.
-
#view_template ⇒ Object
Methods inherited from Brut::FrontEnd::Component
component_name, #component_name
Methods included from Brut::FrontEnd::Component::Helpers
#global_component, #inline_svg
Methods included from I18n::ForHTML
Methods included from I18n::BaseMethods
#l, #t, #t_direct, #this_field_value
Methods included from Brut::Framework::Errors
Constructor Details
#initialize(csrf_token:) ⇒ CsrfToken
Returns a new instance of CsrfToken.
4 5 6 |
# File 'lib/brut/front_end/components/inputs/csrf_token.rb', line 4 def initialize(csrf_token:) @csrf_token = csrf_token end |
Instance Method Details
#view_template ⇒ Object
7 8 9 |
# File 'lib/brut/front_end/components/inputs/csrf_token.rb', line 7 def view_template input(type: "hidden", name: "authenticity_token", value: @csrf_token) end |