Module: Devise::Controllers::InternalHelpers
- Extended by:
- ActiveSupport::Concern
- Includes:
- ScopedViews, SharedHelpers
- Included in:
- Devise::ConfirmationsController, OmniauthCallbacksController, 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.
Constant Summary
Constants included from SharedHelpers
SharedHelpers::MIME_REFERENCES
Instance Method Summary collapse
-
#devise_controller? ⇒ Boolean
Overwrites devise_controller? to return true.
-
#devise_mapping ⇒ Object
Attempt to find the mapped route for devise based on request path.
-
#resource ⇒ Object
Gets the actual resource stored in the instance variable.
-
#resource_class ⇒ Object
Proxy to devise map class.
-
#resource_name ⇒ Object
(also: #scope_name)
Proxy to devise map name.
-
#signed_in_resource ⇒ Object
Returns a signed in resource from session (if one exists).
Instance Method Details
#devise_controller? ⇒ Boolean
Overwrites devise_controller? to return true
50 51 52 |
# File 'lib/devise/controllers/internal_helpers.rb', line 50 def devise_controller? true end |
#devise_mapping ⇒ Object
Attempt to find the mapped route for devise based on request path
45 46 47 |
# File 'lib/devise/controllers/internal_helpers.rb', line 45 def devise_mapping @devise_mapping ||= request.env["devise.mapping"] end |
#resource ⇒ Object
Gets the actual resource stored in the instance variable
24 25 26 |
# File 'lib/devise/controllers/internal_helpers.rb', line 24 def resource instance_variable_get(:"@#{resource_name}") end |
#resource_class ⇒ Object
Proxy to devise map class
35 36 37 |
# File 'lib/devise/controllers/internal_helpers.rb', line 35 def resource_class devise_mapping.to end |
#resource_name ⇒ Object Also known as: scope_name
Proxy to devise map name
29 30 31 |
# File 'lib/devise/controllers/internal_helpers.rb', line 29 def resource_name devise_mapping.name end |
#signed_in_resource ⇒ Object
Returns a signed in resource from session (if one exists)
40 41 42 |
# File 'lib/devise/controllers/internal_helpers.rb', line 40 def signed_in_resource warden.authenticate(:scope => resource_name) end |