Module: ActiveRecord::NullRelation

Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/null_relation.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#any?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/null_relation.rb', line 29

def any?
  false
end

#calculate(operation, _column_name) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/null_relation.rb', line 41

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

#delete(_id_or_array) ⇒ Object



17
18
19
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/null_relation.rb', line 17

def delete(_id_or_array)
  0
end

#delete_allObject



9
10
11
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/null_relation.rb', line 9

def delete_all
  0
end

#empty?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/null_relation.rb', line 21

def empty?
  true
end

#exists?(_conditions = :none) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/null_relation.rb', line 50

def exists?(_conditions = :none)
  false
end

#many?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/null_relation.rb', line 37

def many?
  false
end

#none?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/null_relation.rb', line 25

def none?
  true
end

#one?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/null_relation.rb', line 33

def one?
  false
end

#or(other) ⇒ Object



54
55
56
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/null_relation.rb', line 54

def or(other)
  other.spawn
end

#pluck(*column_names) ⇒ Object



5
6
7
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/null_relation.rb', line 5

def pluck(*column_names)
  []
end

#update_all(_updates) ⇒ Object



13
14
15
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/null_relation.rb', line 13

def update_all(_updates)
  0
end