Module: StaticRails::RequestForgeryProtectionFallback

Included in:
GetsCsrfToken, ValidatesCsrfToken
Defined in:
lib/static-rails/request_forgery_protection_fallback.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, **kwargs, &blk) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/static-rails/request_forgery_protection_fallback.rb', line 3

def method_missing(method_name, *args, **kwargs, &blk)
  if respond_to?(method_name)
    ActionController::RequestForgeryProtection.instance_method(method_name).bind(self).call(*args, **kwargs, &blk)
  else
    super
  end
end

Instance Method Details

#respond_to?(method_name, *args) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/static-rails/request_forgery_protection_fallback.rb', line 11

def respond_to?(method_name, *args)
  ActionController::RequestForgeryProtection.instance_method(method_name) || super
end

#respond_to_missing?(method_name, *args) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/static-rails/request_forgery_protection_fallback.rb', line 15

def respond_to_missing?(method_name, *args)
  ActionController::RequestForgeryProtection.instance_method(method_name) || super
end