Skip to content

Remove ActiveRecord::Relation#calculate patch #1200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading