Skip to content

Commit

Permalink
[irbrc] rails 3 already logs queries in irb by itself
Browse files Browse the repository at this point in the history
  • Loading branch information
ku1ik committed Jan 6, 2013
1 parent f61fab6 commit 0bdbe24
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions .irbrc
Expand Up @@ -63,20 +63,6 @@ def ls(obj=self)
end
end

# Just for Rails3
if defined?(ActiveSupport::Notifications)
$odd_or_even_queries = false
ActiveSupport::Notifications.subscribe('sql.active_record') do |*args|
$odd_or_even_queries = !$odd_or_even_queries
color = $odd_or_even_queries ? "\e[36m" : "\e[35m"
event = ActiveSupport::Notifications::Event.new(*args)
time = "%.1fms" % event.duration
name = event.payload[:name]
sql = event.payload[:sql].gsub("\n", " ").squeeze(" ")
puts " \e[1m#{color}#{name} (#{time})\e[0m #{sql}"
end
end

def mix_colors(c1, c2)
c1.sub!('#')
c2.sub!('#')
Expand Down

0 comments on commit 0bdbe24

Please sign in to comment.