aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/helper.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-06-12 18:38:39 +0100
committerJon Leighton <j@jonathanleighton.com>2011-06-12 18:38:39 +0100
commit232c66a1ba3c683655856d277b7227faa37fb8c3 (patch)
treee0ab2f04c07c3c8d293a7256d115837544103343 /activerecord/test/cases/helper.rb
parentb09bbdb8bf342b3f6d19a2cc2c8860019e39cac9 (diff)
downloadrails-232c66a1ba3c683655856d277b7227faa37fb8c3.tar.gz
rails-232c66a1ba3c683655856d277b7227faa37fb8c3.tar.bz2
rails-232c66a1ba3c683655856d277b7227faa37fb8c3.zip
If we're going to use a global variable, let's at least namespace it
Diffstat (limited to 'activerecord/test/cases/helper.rb')
-rw-r--r--activerecord/test/cases/helper.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb
index aa5f1f528f..6735bc521b 100644
--- a/activerecord/test/cases/helper.rb
+++ b/activerecord/test/cases/helper.rb
@@ -65,9 +65,8 @@ module ActiveRecord
# ignored SQL. This ignored SQL is for Oracle.
ignored_sql.concat [/^select .*nextval/i, /^SAVEPOINT/, /^ROLLBACK TO/, /^\s*select .* from all_triggers/im]
- def initialize
- $queries_executed = []
- end
+ cattr_accessor :log
+ self.log = []
def call(name, start, finish, message_id, values)
sql = values[:sql]
@@ -75,10 +74,11 @@ module ActiveRecord
# FIXME: this seems bad. we should probably have a better way to indicate
# the query was cached
unless 'CACHE' == values[:name]
- $queries_executed << sql unless self.class.ignored_sql.any? { |r| sql =~ r }
+ self.class.log << sql unless self.class.ignored_sql.any? { |r| sql =~ r }
end
end
end
+
ActiveSupport::Notifications.subscribe('sql.active_record', SQLCounter.new)
end