Module: Torque::PostgreSQL::Associations::Preloader

Defined in:
lib/torque/postgresql/associations/preloader.rb,
lib/torque/postgresql/associations/preloader/association.rb

Defined Under Namespace

Modules: Association

Constant Summary collapse

BelongsToMany =
Class.new(::ActiveRecord::Associations::Preloader::HasMany)

Instance Method Summary collapse

Instance Method Details

#preloader_for(reflection, owners) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/torque/postgresql/associations/preloader.rb', line 10

def preloader_for(reflection, owners, *)
  return AlreadyLoaded \
    if owners.first.association(reflection.name).loaded?

  return BelongsToMany \
    if reflection.macro.eql?(:belongs_to_many)

  super
end