Skip to content

Commit 929c226

Browse files
committed
Mark the arguments needed by activerecord-deprecated_finders with a TODO
1 parent e1ce005 commit 929c226

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

activerecord/lib/active_record/associations/collection_association.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ def destroy_all
194194
# Count all records using SQL. Construct options and pass them with
195195
# scope to the target class's +count+.
196196
def count(column_name = nil, count_options = {})
197+
# TODO: Remove count_options argument as soon we remove support to
198+
# activerecord-deprecated_finders.
197199
column_name, count_options = nil, column_name if column_name.is_a?(Hash)
198200

199201
relation = scope

activerecord/lib/active_record/associations/collection_proxy.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,8 @@ def distinct
670670
# # #<Pet id: 3, name: "Choo-Choo", person_id: 1>
671671
# # ]
672672
def count(column_name = nil, options = {})
673+
# TODO: Remove options argument as soon we remove support to
674+
# activerecord-deprecated_finders.
673675
@association.count(column_name, options)
674676
end
675677

activerecord/lib/active_record/null_relation.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ def sum(*)
5050
0
5151
end
5252

53-
def calculate(_operation, _column_name, _options = {})
54-
if _operation == :count
53+
def calculate(operation, _column_name, _options = {})
54+
# TODO: Remove _options argument as soon we remove support to
55+
# activerecord-deprecated_finders.
56+
if operation == :count
5557
0
5658
else
5759
nil

activerecord/lib/active_record/relation/calculations.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ module Calculations
2020
# Person.group(:city).count
2121
# # => { 'Rome' => 5, 'Paris' => 3 }
2222
def count(column_name = nil, options = {})
23+
# TODO: Remove options argument as soon we remove support to
24+
# activerecord-deprecated_finders.
2325
column_name, options = nil, column_name if column_name.is_a?(Hash)
2426
calculate(:count, column_name, options)
2527
end
@@ -29,6 +31,8 @@ def count(column_name = nil, options = {})
2931
#
3032
# Person.average(:age) # => 35.8
3133
def average(column_name, options = {})
34+
# TODO: Remove options argument as soon we remove support to
35+
# activerecord-deprecated_finders.
3236
calculate(:average, column_name, options)
3337
end
3438

@@ -38,6 +42,8 @@ def average(column_name, options = {})
3842
#
3943
# Person.minimum(:age) # => 7
4044
def minimum(column_name, options = {})
45+
# TODO: Remove options argument as soon we remove support to
46+
# activerecord-deprecated_finders.
4147
calculate(:minimum, column_name, options)
4248
end
4349

@@ -47,6 +53,8 @@ def minimum(column_name, options = {})
4753
#
4854
# Person.maximum(:age) # => 93
4955
def maximum(column_name, options = {})
56+
# TODO: Remove options argument as soon we remove support to
57+
# activerecord-deprecated_finders.
5058
calculate(:maximum, column_name, options)
5159
end
5260

@@ -91,6 +99,8 @@ def sum(*args)
9199
#
92100
# Person.sum("2 * age")
93101
def calculate(operation, column_name, options = {})
102+
# TODO: Remove options argument as soon we remove support to
103+
# activerecord-deprecated_finders.
94104
if column_name.is_a?(Symbol) && attribute_alias?(column_name)
95105
column_name = attribute_alias(column_name)
96106
end
@@ -182,6 +192,8 @@ def has_include?(column_name)
182192
end
183193

184194
def perform_calculation(operation, column_name, options = {})
195+
# TODO: Remove options argument as soon we remove support to
196+
# activerecord-deprecated_finders.
185197
operation = operation.to_s.downcase
186198

187199
# If #count is used with #distinct / #uniq it is considered distinct. (eg. relation.distinct.count)

0 commit comments

Comments
 (0)