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 CHANGED
@@ -1,6 +1,6 @@
1
- = query_diet
1
+ = Query Diet
2
2
 
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.
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
1
+ 0.2.0
@@ -1,15 +1,20 @@
1
- require_dependency 'application_controller'
1
+ # require_dependency 'application_controller'
2
2
 
3
- ApplicationController.class_eval do
3
+ already_inherited = defined?(ApplicationController)
4
4
 
5
- around_filter :query_diet_logging
5
+ [ActionController::Base, already_inherited ? ApplicationController : nil].compact.each do |base|
6
+ base.class_eval do
6
7
 
7
- private
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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{query_diet}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Henning Koch"]
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 0.1.0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Henning Koch