Module: ActiveRecord::FinderMethods
- Defined in:
- lib/referrable_joins/active_record_hacks.rb
Instance Method Summary collapse
Instance Method Details
#construct_relation_for_association_calculations ⇒ Object
13 14 15 16 17 18 |
# File 'lib/referrable_joins/active_record_hacks.rb', line 13 def construct_relation_for_association_calculations including = (@eager_load_values + @includes_values).uniq join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, including, nil, arel.joins(arel)) relation = except(:includes, :eager_load, :preload) apply_join_dependency(relation, join_dependency) end |
#find_with_associations ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/referrable_joins/active_record_hacks.rb', line 4 def find_with_associations including = (@eager_load_values + @includes_values).uniq join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, including, nil, nil) rows = construct_relation_for_association_find(join_dependency).to_a join_dependency.instantiate(rows) rescue ThrowResult [] end |