Sha256: 3fac0f6ff924b581192987bc73ec63b41df42437c6b50f6c09414f105209703d
Contents?: true
Size: 920 Bytes
Versions: 17
Compression:
Stored size: 920 Bytes
Contents
ActiveRecord::LogSubscriber # rubocop:disable Lint/Void class ActiveRecord::LogSubscriber # rubocop:disable ClassAndModuleChildren def sql(event) # rubocop:disable AbcSize self.class.runtime += event.duration return unless logger.debug? payload = event.payload name = payload[:name] return if IGNORE_PAYLOAD_NAMES.include?(name) log = { message: name, sql: payload[:sql], duration: event.duration, } unless (payload[:binds] || []).empty? log[:binds] = binds = {} # Changed with Rails 5 if Rails.version.to_i >= 5 payload[:binds].each do |attr| attr_name, value = render_bind(attr) binds[attr_name] = value end else payload[:binds].each do |col, v| attr_name, value = render_bind(col, v) binds[attr_name] = value end end end debug(log) end end
Version data entries
17 entries across 17 versions & 1 rubygems