Class: GemExtensions::ActiveRecord::DisableJoins::Associations::AssociationScope
- Inherits:
-
ActiveRecord::Associations::AssociationScope
- Object
- ActiveRecord::Associations::AssociationScope
- GemExtensions::ActiveRecord::DisableJoins::Associations::AssociationScope
- Defined in:
- lib/gem_extensions/active_record/disable_joins/associations/association_scope.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#scope(association) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/gem_extensions/active_record/disable_joins/associations/association_scope.rb', line 8 def scope(association) source_reflection = association.reflection owner = association.owner unscoped = association.klass.unscoped reverse_chain = get_chain(source_reflection, association, unscoped.alias_tracker).reverse previous_reflection, last_reflection, last_ordered, last_join_ids = last_scope_chain(reverse_chain, owner) add_constraints(last_reflection, last_reflection.join_primary_key, last_join_ids, owner, last_ordered, previous_reflection: previous_reflection) end |