Sha256: 8413e69b157df0ccf713bd0ea8d6b9c855f4821c97272895ace72d1ec41f0997

Contents?: true

Size: 813 Bytes

Versions: 15

Compression:

Stored size: 813 Bytes

Contents

# frozen_string_literal: true

require 'active_record/relation'
require 'active_record/version'

# NOTE: some improvements in active record  broke sql calculations and habtm
# associations for this adapter and the supporting arel visitor.
# this extension fixes this issue in rails 5.1.4 onwards
#
# https://github.com/rails/rails/pull/29848
# https://github.com/rails/rails/pull/30686

module ActiveRecord
  module ConnectionAdapters
    module MSSQL
      module Calculations
        private

        def build_count_subquery(relation, column_name, distinct)
          super(relation.unscope(:order), column_name, distinct)
        end

      end
    end
  end
end

ActiveSupport.on_load(:active_record) do
  mod = ActiveRecord::ConnectionAdapters::MSSQL::Calculations
  ActiveRecord::Relation.prepend(mod)
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
activerecord-jdbc-alt-adapter-61.3.0-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-71.0.0.alpha2-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-71.0.0.alpha1-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-70.2.0-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-70.1.0-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-70.0.0-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-70.0.0.rc2-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-60.3.0-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-61.2.0-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-70.0.0.rc1-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-60.2.0-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-61.1.0-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-61.0.0-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-60.1.0-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-60.0.0-java lib/arjdbc/mssql/extensions/calculations.rb