Skip to content

Commit

Permalink
Remove ActiveRecord::Relation#calculate patch (#1200)
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanharan authored Jul 4, 2024
1 parent 6a4ac60 commit 4cf1084
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
fail-fast: false
matrix:
ruby:
- 2.7.7
- 3.1.3
- 3.2.1

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Unreleased

#### Changed

- [#1200](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1200) Remove ActiveRecord::Relation#calculate patch

## v7.0.6

#### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,6 @@ module ConnectionAdapters
module SQLServer
module CoreExt
module Calculations
# Same as original except we don't perform PostgreSQL hack that removes ordering.
def calculate(operation, column_name)
return super unless klass.connection.adapter_name == "SQLServer"

if has_include?(column_name)
relation = apply_join_dependency

if operation.to_s.downcase == "count"
unless distinct_value || distinct_select?(column_name || select_for_count)
relation.distinct!
relation.select_values = [klass.primary_key || table[Arel.star]]
end
end

relation.calculate(operation, column_name)
else
perform_calculation(operation, column_name)
end
end

private

Expand Down

0 comments on commit 4cf1084

Please sign in to comment.