instance method
find_with_associations
Ruby on Rails 4.1.16
Since v3.0.20 Last seen in v4.2.9 PrivateSignature
find_with_associations()
No documentation comment.
Source
# File activerecord/lib/active_record/relation/finder_methods.rb, line 325
def find_with_associations
# NOTE: the JoinDependency constructed here needs to know about
# any joins already present in `self`, so pass them in
#
# failing to do so means that in cases like activerecord/test/cases/associations/inner_join_association_test.rb:136
# incorrect SQL is generated. In that case, the join dependency for
# SpecialCategorizations is constructed without knowledge of the
# preexisting join in joins_values to categorizations (by way of
# the `has_many :through` for categories).
#
join_dependency = construct_join_dependency(joins_values)
aliases = join_dependency.aliases
relation = select aliases.columns
relation = apply_join_dependency(relation, join_dependency)
if block_given?
yield relation
else
if ActiveRecord::NullRelation === relation
[]
else
rows = connection.select_all(relation.arel, 'SQL', relation.bind_values.dup)
join_dependency.instantiate(rows, aliases)
end
end
end
Defined in activerecord/lib/active_record/relation/finder_methods.rb line 325
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::FinderMethods