Class: Devise::Strategies::Base
- Inherits:
-
Warden::Strategies::Base
- Object
- Warden::Strategies::Base
- Devise::Strategies::Base
- Defined in:
- lib/devise/strategies/base.rb
Overview
Base strategy for Devise. Responsible for verifying correct scope and mapping.
Direct Known Subclasses
Instance Method Summary collapse
-
#klass_type ⇒ Object
Store this class type.
-
#mapping ⇒ Object
Checks if a valid scope was given for devise and find mapping based on this scope.
-
#valid? ⇒ Boolean
Validate strategy.
Instance Method Details
#klass_type ⇒ Object
Store this class type.
19 20 21 |
# File 'lib/devise/strategies/base.rb', line 19 def klass_type @klass_type ||= self.class.name.split("::").last.underscore.to_sym end |
#mapping ⇒ Object
Checks if a valid scope was given for devise and find mapping based on this scope.
14 15 16 |
# File 'lib/devise/strategies/base.rb', line 14 def mapping Devise.mappings[scope] end |
#valid? ⇒ Boolean
Validate strategy. By default will raise an error if no scope or an invalid mapping is found.
7 8 9 10 |
# File 'lib/devise/strategies/base.rb', line 7 def valid? raise "Could not find mapping for #{scope}" unless mapping mapping.for.include?(klass_type) end |