Sha256: 3081fbd148e8ac80f74e296d24054f9bf8e90b6dec58dbc6dbb366ffd4373ea3
Contents?: true
Size: 1.48 KB
Versions: 4
Compression:
Stored size: 1.48 KB
Contents
= Query Diet Query Diet counts the number of database queries for the last request and *subtly* displays it in the upper right corner of your screen. The display turns red if too many queries are run, or if they take too long. This is useful to prevent {N + 1 queries}[http://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations] from creeping into your code. This is Query Diet being happy about 3 requests taking 66ms: http://gem-session.com/files/query_diet_happy.png This is Query Diet being angry about 103 requests taking 164ms: http://gem-session.com/files/query_diet_angry.png == Installation Add it to your Gemfile with gem 'query_diet' Now add the widget to your application layout, like # app/views/layout/application.html.erb # ... <body> <%= query_diet_widget if Rails.env.development? %> <%= yield %> </body> We recommend you only use the gem with the development environment. == Changing warning thresholds You can define when the counter turns into a red warning. The default threshold is 8 queries and 5000 miliseconds. To change the default, simply pass them to the `query_diet_widget` helper: <%= query_diet_widget(:bad_count => 4, :bad_time => 2000) %> == Rails compatibility The gem is tested to work with Rails 2.3, Rails 3.0 and Rails 3.2. === Credits Henning Koch Tobias Kraze {makandra.com}[http://makandra.com/] {gem-session.com}[http://gem-session.com/] {Michael Grosser}[https://github.com/grosser]
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
query_diet-0.5.2 | README.rdoc |
query_diet-0.5.1 | README.rdoc |
query_diet-0.5.0 | README.rdoc |
query_diet-0.4.0 | README.rdoc |