Module: Devise::Controllers::InternalHelpers

Extended by:
ActiveSupport::Concern
Includes:
ScopedViews
Included in:
Devise::ConfirmationsController, PasswordsController, RegistrationsController, SessionsController, UnlocksController
Defined in:
lib/devise/controllers/internal_helpers.rb

Overview

Those helpers are used only inside Devise controllers and should not be included in ApplicationController since they all depend on the url being accessed.

Instance Method Summary collapse

Instance Method Details

#devise_controller?Boolean

Overwrites devise_controller? to return true

Returns:

  • (Boolean)


44
45
46
# File 'lib/devise/controllers/internal_helpers.rb', line 44

def devise_controller?
  true
end

#devise_mappingObject

Attempt to find the mapped route for devise based on request path



39
40
41
# File 'lib/devise/controllers/internal_helpers.rb', line 39

def devise_mapping
  @devise_mapping ||= request.env["devise.mapping"]
end

#resourceObject

Gets the actual resource stored in the instance variable



23
24
25
# File 'lib/devise/controllers/internal_helpers.rb', line 23

def resource
  instance_variable_get(:"@#{resource_name}")
end

#resource_classObject

Proxy to devise map class



34
35
36
# File 'lib/devise/controllers/internal_helpers.rb', line 34

def resource_class
  devise_mapping.to
end

#resource_nameObject Also known as: scope_name

Proxy to devise map name



28
29
30
# File 'lib/devise/controllers/internal_helpers.rb', line 28

def resource_name
  devise_mapping.name
end