Sha256: 5d83822c793209317b3307c0a114e8ff12ff3e620d7d7bf48755115797f88f17

Contents?: true

Size: 895 Bytes

Versions: 6

Compression:

Stored size: 895 Bytes

Contents

# -*- coding: utf-8 -*-

module ActiveRecord
  module NullRelation # :nodoc:
    def exec_queries
      @records = []
    end

    def pluck(*column_names)
      []
    end

    def delete_all(_conditions = nil)
      0
    end

    def update_all(_updates, _conditions = nil, _options = {})
      0
    end

    def delete(_id_or_array)
      0
    end

    def size
      0
    end

    def empty?
      true
    end

    def any?
      false
    end

    def many?
      false
    end

    def to_sql
      ""
    end

    def count(*)
      0
    end

    def sum(*)
      0
    end

    def calculate(operation, _column_name, _options = {})
      # TODO: Remove _options argument as soon we remove support to
      # activerecord-deprecated_finders.
      if operation == :count
        0
      else
        nil
      end
    end

    def exists?(_id = false)
      false
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
activerecord-4.1.1 lib/active_record/null_relation.rb
activerecord-4.1.0 lib/active_record/null_relation.rb
activerecord-4.1.0.rc2 lib/active_record/null_relation.rb
activerecord-4.1.0.rc1 lib/active_record/null_relation.rb
activerecord-4.1.0.beta2 lib/active_record/null_relation.rb
activerecord-4.1.0.beta1 lib/active_record/null_relation.rb