Sha256: 25d7351fbcc5832ab24d4d516df6226441df9ac26703060f2b13fc06c5d8ab99

Contents?: true

Size: 854 Bytes

Versions: 43

Compression:

Stored size: 854 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord
  module NullRelation # :nodoc:
    def pluck(*column_names)
      []
    end

    def delete_all
      0
    end

    def update_all(_updates)
      0
    end

    def delete(_id_or_array)
      0
    end

    def empty?
      true
    end

    def none?
      true
    end

    def any?
      false
    end

    def one?
      false
    end

    def many?
      false
    end

    def calculate(operation, _column_name)
      case operation
      when :count, :sum
        group_values.any? ? Hash.new : 0
      when :average, :minimum, :maximum
        group_values.any? ? Hash.new : nil
      end
    end

    def exists?(_conditions = :none)
      false
    end

    def or(other)
      other.spawn
    end

    private
      def exec_main_query(async: false)
        [].freeze
      end
  end
end

Version data entries

43 entries across 41 versions & 6 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.8.7/lib/active_record/null_relation.rb
activerecord-7.0.8.7 lib/active_record/null_relation.rb
activerecord-7.0.8.6 lib/active_record/null_relation.rb
activerecord-7.0.8.5 lib/active_record/null_relation.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/null_relation.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.5.1/lib/active_record/null_relation.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.5.1/lib/active_record/null_relation.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/activerecord-7.0.5.1/lib/active_record/null_relation.rb
activerecord-7.0.8.4 lib/active_record/null_relation.rb
activerecord-7.0.8.1 lib/active_record/null_relation.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activerecord-7.0.3.1/lib/active_record/null_relation.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activerecord-7.0.2.3/lib/active_record/null_relation.rb
activerecord-7.0.8 lib/active_record/null_relation.rb
activerecord-7.0.7.2 lib/active_record/null_relation.rb
activerecord-7.0.7.1 lib/active_record/null_relation.rb
activerecord-7.0.7 lib/active_record/null_relation.rb
activerecord-7.0.6 lib/active_record/null_relation.rb
activerecord-7.0.5.1 lib/active_record/null_relation.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activerecord-7.0.3.1/lib/active_record/null_relation.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activerecord-7.0.2.3/lib/active_record/null_relation.rb