diff --git a/lib/active_record/connection_adapters/sqlserver/transaction.rb b/lib/active_record/connection_adapters/sqlserver/transaction.rb index 84e13ede1..7f321d20e 100644 --- a/lib/active_record/connection_adapters/sqlserver/transaction.rb +++ b/lib/active_record/connection_adapters/sqlserver/transaction.rb @@ -31,10 +31,18 @@ def current_isolation_level module SQLServerRealTransaction attr_reader :starting_isolation_level - def initialize(connection, **args) - @connection = connection - @starting_isolation_level = current_isolation_level if args[:isolation] - super + if Rails::VERSION::MAJOR >= 6 && Rails::VERSION::MINOR >= 1 + def initialize(connection, **args) + @connection = connection + @starting_isolation_level = current_isolation_level if args[:isolation] + super + end + else + def initialize(connection, options, **args) + @connection = connection + @starting_isolation_level = current_isolation_level if options[:isolation] + super + end end def commit