Module: ActiveRecord::ConnectionAdapters::SQLServer::CoreExt::Calculations
- Defined in:
- lib/active_record/connection_adapters/sqlserver/core_ext/calculations.rb
Instance Method Summary collapse
-
#calculate(operation, column_name) ⇒ Object
Same as original except we don't perform PostgreSQL hack that removes ordering.
Instance Method Details
#calculate(operation, column_name) ⇒ Object
Same as original except we don't perform PostgreSQL hack that removes ordering.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/active_record/connection_adapters/sqlserver/core_ext/calculations.rb', line 12 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 |