Sha256: b695ed3fe8f14e5ef2af7f984eac8eac97c7905a5f7bcb46b0fbec8cbf05eb4c
Contents?: true
Size: 938 Bytes
Versions: 45
Compression:
Stored size: 938 Bytes
Contents
module RorVsWild module Plugin class ActiveRecord def self.setup return if @installed setup_callback @installed = true end def self.setup_callback return unless defined?(::ActiveSupport::Notifications.subscribe) ActiveSupport::Notifications.subscribe("sql.active_record", new) end IGNORED_QUERIES = %w[EXPLAIN SCHEMA].freeze APPENDABLE_QUERIES = ["BEGIN", "COMMIT"].freeze def start(name, id, payload) return if IGNORED_QUERIES.include?(payload[:name]) RorVsWild::Section.start do |section| section.appendable_command = APPENDABLE_QUERIES.include?(payload[:sql]) section.command = payload[:sql] section.kind = "sql".freeze end end def finish(name, id, payload) return if IGNORED_QUERIES.include?(payload[:name]) RorVsWild::Section.stop end end end end
Version data entries
45 entries across 45 versions & 1 rubygems