Module: EasyAuth::Password::Models::Account::ClassMethods
- Defined in:
- lib/easy_auth/password/models/account.rb
Instance Method Summary collapse
-
#identity_uid_attributes ⇒ Symbol
Will attempt to find the uid attributes of :username and :email Will return an array of any defined on the model If neither are defined an exception will be raised.
Instance Method Details
#identity_uid_attributes ⇒ Symbol
Will attempt to find the uid attributes of :username and :email Will return an array of any defined on the model If neither are defined an exception will be raised
Override this method with an array of symbols for custom attributes
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/easy_auth/password/models/account.rb', line 30 def identity_uid_attributes if table_exists? attributes = (['email', 'username'] & column_names).map(&:to_sym) else attributes = [] end if attributes.empty? raise EasyAuth::Password::Models::Account::NoIdentityUIDError, 'your model must have either a #username or #email attribute. Or you must override the .identity_uid_attribute class method' else attributes end end |