Module: ActiveModel::Associations::AssociationScopeExtension

Defined in:
lib/active_model/associations/association_scope_extension.rb

Instance Method Summary collapse

Instance Method Details

#add_constraints(scope, owner, assoc_klass, refl, tracker) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/active_model/associations/association_scope_extension.rb', line 4

def add_constraints(scope, owner, association_klass, refl, chain_head, chain_tail)
  if refl.options[:active_model]
    target_ids = refl.options[:target_ids]
    return scope.where(id: owner[target_ids])
  end

  super
end