method

construct_relation_for_exists

Importance_0
v5.2.3 - Show latest stable - 0 notes - Class: ActiveRecord::FinderMethods
construct_relation_for_exists(conditions) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/relation/finder_methods.rb, line 361
      def construct_relation_for_exists(conditions)
        if distinct_value && offset_value
          relation = limit(1)
        else
          relation = except(:select, :distinct, :order)._select!(ONE_AS_ONE).limit!(1)
        end

        case conditions
        when Array, Hash
          relation.where!(conditions) unless conditions.empty?
        else
          relation.where!(primary_key => conditions) unless conditions == :none
        end

        relation
      end
Register or log in to add new notes.