Sha256: 6e3faecafbae0ec98c8ed1a6799d36b7b84f5192854d91fc4ef78c8eedd7688d

Contents?: true

Size: 881 Bytes

Versions: 59

Compression:

Stored size: 881 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 to_sql
      ""
    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_queries
        @records = [].freeze
      end
  end
end

Version data entries

59 entries across 59 versions & 4 rubygems

Version Path
activerecord-6.0.4.8 lib/active_record/null_relation.rb
activerecord-6.1.5 lib/active_record/null_relation.rb
activerecord-6.1.4.7 lib/active_record/null_relation.rb
activerecord-6.0.4.7 lib/active_record/null_relation.rb
activerecord-6.1.4.6 lib/active_record/null_relation.rb
activerecord-6.0.4.6 lib/active_record/null_relation.rb
activerecord-6.0.4.5 lib/active_record/null_relation.rb
activerecord-6.1.4.5 lib/active_record/null_relation.rb
activerecord-6.1.4.4 lib/active_record/null_relation.rb
activerecord-6.0.4.4 lib/active_record/null_relation.rb
activerecord-6.1.4.3 lib/active_record/null_relation.rb
activerecord-6.0.4.3 lib/active_record/null_relation.rb
activerecord-6.0.4.2 lib/active_record/null_relation.rb
activerecord-6.1.4.2 lib/active_record/null_relation.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/null_relation.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/null_relation.rb
activerecord-6.1.4.1 lib/active_record/null_relation.rb
activerecord-6.0.4.1 lib/active_record/null_relation.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4/lib/active_record/null_relation.rb
activerecord-6.1.4 lib/active_record/null_relation.rb