Permalink
Browse files

Updated with support for Rails 2.2

  • Loading branch information...
1 parent fb4a56d commit d267ee0cbaf7abc0b9cc9baa7448325d7d4ea394 @mikedemers committed Dec 19, 2008
Showing with 7 additions and 3 deletions.
  1. +4 −0 README
  2. +3 −3 lib/nine_astronauts/database_counters/controller_mixin.rb
View
4 README
@@ -19,6 +19,10 @@ Enabling in a Controller:
Will result in log output like so:
+ Completed in 847ms (View: 0, DB: 5 Calls: 92 Rows: 671) | 200 OK [http://localhost/]
+
+Or, in older (< 2.2) versions of Rails:
+
Completed in 0.05835 (17 reqs/sec) | Rendering: 0.00007 (0%) | DB: 0.00265 (4%) Calls: 5 Rows: 6 | 200 OK [http://localhost/]
@@ -54,15 +54,15 @@ module InstanceMethods
#
# ... | DB: 3.14276 (97%) Calls: 27 Rows: 43 | ...
#
- def active_record_runtime_with_database_counters(runtime)
+ def active_record_runtime_with_database_counters(*args)
if NineAstronauts::DatabaseCounters::Counters.active?
"%s Calls: %d Rows: %d" % [
- active_record_runtime_without_database_counters(runtime),
+ active_record_runtime_without_database_counters(*args),
NineAstronauts::DatabaseCounters::Counters.queries,
NineAstronauts::DatabaseCounters::Counters.rows
]
else
- active_record_runtime_without_database_counters(runtime)
+ active_record_runtime_without_database_counters(*args)
end
end

0 comments on commit d267ee0

Please sign in to comment.