Module: Authenticate::Modules
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/authenticate/modules.rb
Overview
Modules injects Authenticate modules into the app User model.
Modules are loaded into the user model with class method ‘load_modules`. Authenticate::User calls `load_modules`. Modules are specified in the config as constants; `load_modules` requires them, turns them into constants, checks for required fields (see below), and then includes them into the user.
Any module being loaded into User can optionally define a class method ‘required_fields(klass)` defining any required attributes in the User model. For example, the :username module declares:
module Username
extend ActiveSupport::Concern
def self.required_fields(klass)
[:username]
end
...
If the model class is missing a required field, Authenticate will fail with a MissingAttribute error. The error will declare what required fields are missing.
Defined Under Namespace
Modules: ClassMethods Classes: MissingAttribute