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
-
#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
#mapping ⇒ Object
Checks if a valid scope was given for devise and find mapping based on this scope.
15 16 17 18 19 20 21 |
# File 'lib/devise/strategies/base.rb', line 15 def mapping @mapping ||= begin raise "You need to give a scope for Devise authentication" unless scope raise "You need to give a valid Devise mapping" unless mapping = Devise.mappings[scope] mapping end end |
#valid? ⇒ Boolean
Validate strategy. By default will raise an error if no scope or an invalid mapping is found.
9 10 11 |
# File 'lib/devise/strategies/base.rb', line 9 def valid? mapping.for.include?(self.class.name.split("::").last.underscore.to_sym) end |