Sha256: d47eace09e087c2bf9b91d4c9438d04177181001e04a4efe4cd6e6413d215a8a

Contents?: true

Size: 775 Bytes

Versions: 13

Compression:

Stored size: 775 Bytes

Contents

require 'active_record/test_case.rb'

# TODO: I'm struggling to figure out how to unsubscribe from only one 'sql.active_record'
# This is a temporary hack until we can just get the sqlserver_ignored regex in rails
ActiveSupport::Notifications.notifier.listeners_for('sql.active_record').each do |listener|
  if listener.inspect =~ /ActiveRecord::SQLCounter/
    ActiveSupport::Notifications.unsubscribe(listener)
  end
end

module ActiveRecord
  class SQLCounter
    sqlserver_ignored =  [/SELECT SCOPE_IDENTITY/, /INFORMATION_SCHEMA\.(TABLES|VIEWS|COLUMNS)/, /SELECT @@version/, /SELECT @@TRANCOUNT/, /(BEGIN|COMMIT|ROLLBACK|SAVE) TRANSACTION/]
    ignored_sql.concat sqlserver_ignored
  end
  ActiveSupport::Notifications.subscribe('sql.active_record', SQLCounter.new)
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
activerecord-sqlserver-adapter-4.1.8 lib/active_record/sqlserver_test_case.rb
activerecord-sqlserver-adapter-4.0.4 lib/active_record/sqlserver_test_case.rb
activerecord-sqlserver-adapter-4.1.7 lib/active_record/sqlserver_test_case.rb
activerecord-sqlserver-adapter-4.0.3 lib/active_record/sqlserver_test_case.rb
activerecord-sqlserver-adapter-4.1.6 lib/active_record/sqlserver_test_case.rb
activerecord-sqlserver-adapter-4.0.2 lib/active_record/sqlserver_test_case.rb
activerecord-sqlserver-adapter-4.1.5 lib/active_record/sqlserver_test_case.rb
activerecord-sqlserver-adapter-4.1.4 lib/active_record/sqlserver_test_case.rb
activerecord-sqlserver-adapter-4.0.1 lib/active_record/sqlserver_test_case.rb
activerecord-sqlserver-adapter-4.1.2 lib/active_record/sqlserver_test_case.rb
activerecord-sqlserver-adapter-4.1.1 lib/active_record/sqlserver_test_case.rb
activerecord-sqlserver-adapter-4.1.0 lib/active_record/sqlserver_test_case.rb
activerecord-sqlserver-adapter-4.0.0 lib/active_record/sqlserver_test_case.rb