Sha256: fff6e1154121edcb357c80f6f8b8ac18a56e3bf3ab4cb74d6d408087ae7b00e3

Contents?: true

Size: 782 Bytes

Versions: 15

Compression:

Stored size: 782 Bytes

Contents

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-52.6.0-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-51.7.0-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-52.5.1-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-51.6.1-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-52.4.0-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-51.5.0-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-51.3.4-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-52.2.3-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-52.2.2-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-51.3.3-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-51.3.2-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-52.2.1-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-51.3.1-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-52.2.0-java lib/arjdbc/mssql/extensions/calculations.rb
activerecord-jdbc-alt-adapter-51.3.0-java lib/arjdbc/mssql/extensions/calculations.rb