query_diet 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/VERSION +1 -1
- data/lib/query_diet/action_controller_ext.rb +13 -8
- data/query_diet.gemspec +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
=
|
1
|
+
= Query Diet
|
2
2
|
|
3
|
-
|
3
|
+
Query Diet counts the number of database queries for the last request and *subtly* displays it in the upper right corner of your screen.
|
4
4
|
The display turns red if too many queries are run, or if they take too long.
|
5
5
|
This is useful to prevent {N + 1 queries}[http://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations] from creeping into your code.
|
6
6
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -1,15 +1,20 @@
|
|
1
|
-
require_dependency 'application_controller'
|
1
|
+
# require_dependency 'application_controller'
|
2
2
|
|
3
|
-
ApplicationController
|
3
|
+
already_inherited = defined?(ApplicationController)
|
4
4
|
|
5
|
-
|
5
|
+
[ActionController::Base, already_inherited ? ApplicationController : nil].compact.each do |base|
|
6
|
+
base.class_eval do
|
6
7
|
|
7
|
-
|
8
|
+
around_filter :query_diet_logging
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def query_diet_logging
|
13
|
+
QueryDiet::Logger.reset
|
14
|
+
yield
|
15
|
+
QueryDiet::Widget.render(response)
|
16
|
+
end
|
8
17
|
|
9
|
-
def query_diet_logging
|
10
|
-
QueryDiet::Logger.reset
|
11
|
-
yield
|
12
|
-
QueryDiet::Widget.render(response)
|
13
18
|
end
|
14
19
|
|
15
20
|
end
|
data/query_diet.gemspec
CHANGED