Module: Amalgam::Authorities::Model::ClassMethods

Defined in:
lib/amalgam/authorities/model.rb

Instance Method Summary collapse

Instance Method Details

#authenticate(conditions, password) ⇒ Model

Authenticate a user with the given key and password.

Parameters:

  • key (String)

    The unique login key provided for a given user.

  • password (String)

    The presumed password for the user.

Returns:

  • (Model)

    An instance of the user model class.



19
20
21
22
23
# File 'lib/amalgam/authorities/model.rb', line 19

def authenticate(conditions, password)
  instance = locate(conditions)
  return false unless instance
  instance.authenticate(password)
end

#locate(key) ⇒ Model

This method is abstract.

Locate an model given its unique login key.

Parameters:

  • key (String)

    The unique login key.

Returns:

  • (Model)

    An instance of the user model class.

Raises:

  • (NotImplementedError)


10
11
12
# File 'lib/amalgam/authorities/model.rb', line 10

def locate(key)
  raise NotImplementedError
end