instance method
sql
Ruby on Rails 4.1.16
Since v3.0.20 Last seen in v8.0.4Signature
sql(event)
No documentation comment.
Parameters
-
eventreq
Source
# File activerecord/lib/active_record/log_subscriber.rb, line 37
def sql(event)
self.class.runtime += event.duration
return unless logger.debug?
payload = event.payload
return if IGNORE_PAYLOAD_NAMES.include?(payload[:name])
name = "#{payload[:name]} (#{event.duration.round(1)}ms)"
sql = payload[:sql]
binds = nil
unless (payload[:binds] || []).empty?
binds = " " + payload[:binds].map { |col,v|
render_bind(col, v)
}.inspect
end
if odd?
name = color(name, CYAN, true)
sql = color(sql, nil, true)
else
name = color(name, MAGENTA, true)
end
debug " #{name} #{sql}#{binds}"
end
Defined in activerecord/lib/active_record/log_subscriber.rb line 37
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::LogSubscriber