Module: Devise::Controllers::InternalHelpers
- Included in:
- 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.
Defined Under Namespace
Modules: ScopedViews
Class Method Summary collapse
-
.included(base) ⇒ Object
:nodoc:.
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.
Class Method Details
.included(base) ⇒ Object
:nodoc:
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/devise/controllers/internal_helpers.rb', line 8 def self.included(base) base.class_eval do extend ScopedViews unloadable helper_method :resource, :scope_name, :resource_name, :resource_class, :devise_mapping, :devise_controller? hide_action :resource, :scope_name, :resource_name, :resource_class, :devise_mapping, :devise_controller? skip_before_filter *Devise.mappings.keys.map { |m| :"authenticate_#{m}!" } prepend_before_filter :is_devise_resource? end end |
Instance Method Details
#devise_controller? ⇒ Boolean
Overwrites devise_controller? to return true
57 58 59 |
# File 'lib/devise/controllers/internal_helpers.rb', line 57 def devise_controller? true end |
#devise_mapping ⇒ Object
Attempt to find the mapped route for devise based on request path
48 49 50 51 52 53 54 |
# File 'lib/devise/controllers/internal_helpers.rb', line 48 def devise_mapping @devise_mapping ||= begin mapping = Devise::Mapping.find_by_path(request.path) mapping ||= Devise.mappings[Devise.default_scope] if Devise.use_default_scope mapping end end |
#resource ⇒ Object
Gets the actual resource stored in the instance variable
32 33 34 |
# File 'lib/devise/controllers/internal_helpers.rb', line 32 def resource instance_variable_get(:"@#{resource_name}") end |
#resource_class ⇒ Object
Proxy to devise map class
43 44 45 |
# File 'lib/devise/controllers/internal_helpers.rb', line 43 def resource_class devise_mapping.to end |
#resource_name ⇒ Object Also known as: scope_name
Proxy to devise map name
37 38 39 |
# File 'lib/devise/controllers/internal_helpers.rb', line 37 def resource_name devise_mapping.name end |