Sha256: 6a81f9db170f0838d6058bbca4034347a1d9c1851dd4b5470fc486ca48364cc5
Contents?: true
Size: 787 Bytes
Versions: 1
Compression:
Stored size: 787 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 = [%r|SELECT SCOPE_IDENTITY|, %r{INFORMATION_SCHEMA\.(TABLES|VIEWS|COLUMNS)},%r|SELECT @@version|, %r|SELECT @@TRANCOUNT|, %r{(BEGIN|COMMIT|ROLLBACK|SAVE) TRANSACTION}] ignored_sql.concat sqlserver_ignored end ActiveSupport::Notifications.subscribe('sql.active_record', SQLCounter.new) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sic-activerecord-sqlserver-adapter-4.0.0 | lib/active_record/sqlserver_test_case.rb |