query_diet 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dfce4f3d1d964e4c70787f58992eaa8d43ea6aff
4
- data.tar.gz: 682b5ec519d0f41cba2a28fa90d76e9a3e999f82
3
+ metadata.gz: 63b41117d8dd5d5e67272b8d4fcabc22b4068bac
4
+ data.tar.gz: '08680b0daeeb2198831f722750cc6d494ff59e82'
5
5
  SHA512:
6
- metadata.gz: 2d35b564c2e9e8c34f5c603e1064eb71bb68a06122d1568184743086e320af7c81697b5a1c20c25fdad528ba3f7d8ebcce4cbbf7b192cc8400a32bba55aa0187
7
- data.tar.gz: 01209f211d0af8ccd1f4b1573364e9996f2361a691d44ff7481386d732a7a9e3c5aed1f921b7eab8ca02cbf03010687ba026dbb73b42980bf9382ed32cf1f9ea
6
+ metadata.gz: f34ca786690572f2b092b4150792be7e8734a74245fb63754b4fbfb8ad1c7caa0f250bb52ec1176b9aa2f57db777ec03413ac1f01be6e90580a844a53bfb8dac
7
+ data.tar.gz: b94095083324e7b117315ffb69e6b76b334714daa7e654f14f69425f491dd08fb8d77856126f3781c41522437d0566125f1c4dc39d07170453a8f38c2d0bdf2e
data/README.md ADDED
@@ -0,0 +1,67 @@
1
+ Query Diet [![Build Status](https://travis-ci.org/makandra/query_diet.svg?branch=master)](https://travis-ci.org/makandra/query_diet)
2
+ ==========
3
+
4
+ Query Diet counts the number of database queries for the last request and *subtly* displays it in the upper right corner of your screen.
5
+ The display turns red if too many queries are run, or if they take too long.
6
+ This is useful to prevent [N + 1 queries](http://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations) from creeping into your code.
7
+
8
+ This is Query Diet being happy about 3 requests taking 66ms:
9
+
10
+ ![](http://blog.makandra.com/images/articles/2010-06-25-solving-the-n-1-query-problem-with-query-diet/query_diet_happy.png)
11
+
12
+ This is Query Diet being angry about 103 requests taking 164ms:
13
+
14
+ ![](http://blog.makandra.com/images/articles/2010-06-25-solving-the-n-1-query-problem-with-query-diet/query_diet_angry.png)
15
+
16
+
17
+ Installation
18
+ ------------
19
+
20
+ Add it to your Gemfile with
21
+
22
+ ```Ruby
23
+ gem 'query_diet', group: :development
24
+ ```
25
+
26
+ Now add the widget to your application layout, like
27
+
28
+ ```Erb
29
+ # app/views/layout/application.html.erb
30
+ # ...
31
+ <body>
32
+ <%= query_diet_widget if Rails.env.development? %>
33
+ <%= yield %>
34
+ </body>
35
+ ```
36
+
37
+ We recommend you only use the gem with the development environment.
38
+
39
+ ### Changing warning thresholds
40
+
41
+ You can define when the counter turns into a red warning. The default threshold is 8 queries and 5000 miliseconds.
42
+ To change the default, simply pass them to the `query_diet_widget` helper:
43
+
44
+ ```Erb
45
+ <%= query_diet_widget(:bad_count => 4, :bad_time => 2000) %>
46
+ ```
47
+
48
+
49
+ ### Rails compatibility
50
+
51
+ The gem is tested to work with Rails 3.2+ and Ruby 2.0+.
52
+
53
+ For Rails 2.3 and Ruby 1.8.7 support, use a version < 0.6.
54
+
55
+
56
+ Credits
57
+ -------
58
+
59
+ [Henning Koch](https://github.com/henning-koch)
60
+
61
+ [Tobias Kraze](https://github.com/kratob)
62
+
63
+ [makandra.com](http://makandra.com/)
64
+
65
+ [gem-session.com](http://gem-session.com/)
66
+
67
+ [Michael Grosser](https://github.com/grosser)
@@ -1,12 +1,9 @@
1
- ActiveRecord::ConnectionAdapters::AbstractAdapter.class_eval do
2
-
3
- def log_with_query_diet(query, *args, &block)
4
- QueryDiet::Logger.log(query) do
5
- log_without_query_diet(query, *args, &block)
1
+ module QueryDiet
2
+ module ActiveRecordExt
3
+ def log(query, *)
4
+ QueryDiet::Logger.log(query) { super }
6
5
  end
7
6
  end
8
-
9
- alias_method :log_without_query_diet, :log
10
- alias_method :log, :log_with_query_diet
11
-
12
7
  end
8
+
9
+ ActiveRecord::ConnectionAdapters::AbstractAdapter.send(:prepend, QueryDiet::ActiveRecordExt)
@@ -1,3 +1,3 @@
1
1
  module QueryDiet
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: query_diet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-02-12 00:00:00.000000000 Z
12
+ date: 2017-02-07 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Rails database query counter that stays out of your way
15
15
  email: github@makandra.de
@@ -18,7 +18,7 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - MIT-LICENSE
21
- - README.rdoc
21
+ - README.md
22
22
  - lib/query_diet.rb
23
23
  - lib/query_diet/active_record_ext.rb
24
24
  - lib/query_diet/logger.rb
@@ -45,7 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
45
45
  version: '0'
46
46
  requirements: []
47
47
  rubyforge_project:
48
- rubygems_version: 2.4.8
48
+ rubygems_version: 2.5.1
49
49
  signing_key:
50
50
  specification_version: 4
51
51
  summary: Rails database query counter that stays out of your way
data/README.rdoc DELETED
@@ -1,60 +0,0 @@
1
- = Query Diet {<img src="https://travis-ci.org/makandra/query_diet.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/makandra/query_diet]
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.
4
- The display turns red if too many queries are run, or if they take too long.
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
-
7
- This is Query Diet being happy about 3 requests taking 66ms:
8
-
9
- http://blog.makandra.com/images/articles/2010-06-25-solving-the-n-1-query-problem-with-query-diet/query_diet_happy.png
10
-
11
- This is Query Diet being angry about 103 requests taking 164ms:
12
-
13
- http://blog.makandra.com/images/articles/2010-06-25-solving-the-n-1-query-problem-with-query-diet/query_diet_angry.png
14
-
15
-
16
-
17
- == Installation
18
-
19
- Add it to your Gemfile with
20
- gem 'query_diet'
21
-
22
-
23
- Now add the widget to your application layout, like
24
-
25
- # app/views/layout/application.html.erb
26
- # ...
27
- <body>
28
- <%= query_diet_widget if Rails.env.development? %>
29
- <%= yield %>
30
- </body>
31
-
32
-
33
- We recommend you only use the gem with the development environment.
34
-
35
- == Changing warning thresholds
36
-
37
- You can define when the counter turns into a red warning. The default threshold is 8 queries and 5000 miliseconds.
38
- To change the default, simply pass them to the `query_diet_widget` helper:
39
-
40
- <%= query_diet_widget(:bad_count => 4, :bad_time => 2000) %>
41
-
42
-
43
- == Rails compatibility
44
-
45
- The gem is tested to work with Rails 3.2+ and Ruby 2.0+.
46
-
47
- For Rails 2.3 and Ruby 1.8.7 support, use a version < 0.6.
48
-
49
-
50
- === Credits
51
-
52
- Henning Koch
53
-
54
- Tobias Kraze
55
-
56
- {makandra.com}[http://makandra.com/]
57
-
58
- {gem-session.com}[http://gem-session.com/]
59
-
60
- {Michael Grosser}[https://github.com/grosser]