method
construct_relation_for_exists
v5.1.7 -
Show latest stable
- Class:
ActiveRecord::FinderMethods
construct_relation_for_exists(relation, conditions)private
No documentation available.
# File activerecord/lib/active_record/relation/finder_methods.rb, line 377
def construct_relation_for_exists(relation, conditions)
relation = relation.except(:select, :distinct, :order)._select!(ONE_AS_ONE).limit!(1)
case conditions
when Array, Hash
relation.where!(conditions) unless conditions.empty?
else
relation.where!(primary_key => conditions) unless conditions == :none
end
relation
end