Module: Upgrow::ActiveRecordQueries::ClassMethods

Defined in:
lib/upgrow/active_record_queries.rb

Overview

Class methods for classes that include this module.

Instance Method Summary collapse

Instance Method Details

#default_baseClass

Callback method used by Basic Repository to set a default Repository base when one is not explicitly provided at the Repository initialization.

It attempts to find a constant based on the Repository name, with the ‘Record` suffix as a convention. For example, a `UserRepository` would have the `UserRecord` as its base. That is the naming convention for Active Record classes under this architecture.

Returns:

  • (Class)

    the Active Record Base class to be used as the Repository base according to the architecture’s naming convention.



21
22
23
# File 'lib/upgrow/active_record_queries.rb', line 21

def default_base
  Object.const_get(Naming.repository_to_record(name))
end