Class: OmniAuth::Identity::Models::ActiveRecord
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- OmniAuth::Identity::Models::ActiveRecord
- Includes:
- OmniAuth::Identity::Model, SecurePassword
- Defined in:
- lib/omniauth/identity/models/active_record.rb
Overview
ActiveRecord is based on ActiveModel, so validations are enabled by default.
This is an abstract class; inherit from it to create your user model.
ActiveRecord is an ORM for MySQL, PostgreSQL, and SQLite3:
https://guides.rubyonrails.org/active_record_basics.html
This class provides a base for OmniAuth Identity models using ActiveRecord,
including secure password handling and authentication key management.
Constant Summary
Constants included from SecurePassword
SecurePassword::MAX_PASSWORD_LENGTH_ALLOWED
Constants included from OmniAuth::Identity::Model
OmniAuth::Identity::Model::SCHEMA_ATTRIBUTES
Instance Attribute Summary
Attributes included from SecurePassword
Attributes included from OmniAuth::Identity::Model
Class Method Summary collapse
-
.auth_key=(key) ⇒ void
Sets the authentication key for the model and adds uniqueness validation.
-
.locate(search_hash) ⇒ ActiveRecord::Base?
Finds a record by the given search criteria.
Methods included from SecurePassword
Methods included from OmniAuth::Identity::Model
#auth_key, #auth_key=, #authenticate, included, #info, #uid
Class Method Details
.auth_key=(key) ⇒ void
This method returns an undefined value.
Sets the authentication key for the model and adds uniqueness validation.
54 55 56 57 |
# File 'lib/omniauth/identity/models/active_record.rb', line 54 def self.auth_key=(key) super validates_uniqueness_of(key, case_sensitive: false) end |
.locate(search_hash) ⇒ ActiveRecord::Base?
Finds a record by the given search criteria.
If the model has a ‘provider’ column, it defaults to ‘identity’.
68 69 70 71 |
# File 'lib/omniauth/identity/models/active_record.rb', line 68 def self.locate(search_hash) search_hash = search_hash.reverse_merge!("provider" => "identity") if column_names.include?("provider") where(search_hash).first end |