Skip to content

Loading…

Disabled by default except on development #5

Open
wants to merge 3 commits into from

1 participant

@jaimeiniesta

Hi!

Thanks for making this compatible with rails 3. I love it!

I've made a little change, so that on the generated query_reviewer.yml, it sets "enabled=false" for all environments and then it gets overriden to true for development. This way, you can't forget to disable it on other environments like staging or integration, and you only need to change this file if you want to explicitly enable it on some other environments.

Also, I've fixed a small typo and updated the README.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 12 deletions.
  1. +4 −4 README.md
  2. +1 −1 lib/query_reviewer/views/_box_disabled.html.erb
  3. +2 −7 query_reviewer_defaults.yml
View
8 README.md
@@ -35,11 +35,11 @@ All you have to do is install it into your Rails 2 or 3 project.
Right now if you use bundler, simply add this to your Gemfile:
# Gemfile
- gem "query_reviewer", :git => "git://github.com/nesquena/query_reviewer.git"
+ gem "query_reviewer"
If you are not using bundler, you might want to [start using it](http://gembundler.com/rails23.html). You can also install this as a plugin:
- script/plugin install git://github.com/nesquena/query_reviewer.git
+ script/plugin install git://github.com/dsboulder/query_reviewer.git
In Rails 2, the rake tasks are not loaded automatically (as a gem), you’ll need to add the following to your Rakefile:
@@ -59,9 +59,9 @@ If you don't create a config file, the gem will use the default in `vendor/plugi
## Configuration ##
-The configuration file allows you to set configuration parameters shared across all rails environment, as well as overriding those shared parameteres with environment-specific parameters (such as disabling analysis on production!)
+The configuration file allows you to set configuration parameters shared across all rails environment, as well as overriding those shared parameteres with environment-specific parameters.
- * `enabled`: whether any output or query analysis is performed. Set this false in production!
+ * `enabled`: whether any output or query analysis is performed. By default, it's disabled for all environments except development.
* `inject_view`: controls whether the output automatically is injected before the </body> in HTML output.
* `profiling`: when enabled, runs the MySQL SET PROFILING=1 for queries longer than the `warn_duration_threshold` / 2.0
* `production_data`: whether the duration of a query should be taken into account
View
2 lib/query_reviewer/views/_box_disabled.html.erb
@@ -1,2 +1,2 @@
<p>SQL analysis has been disabled for you. A cookie must be set to enable analysis. This generally slows down your browser, so it's only recommended for users analyzing SQL queries.</p>
-<p id="query_review_enable_link"><b><a href="javascript: createCookie('query_review_enabled', '1'); query_review_hide('query_review_enable_link'); alert('Cookie successfully set.');">Enabled it</a> on next page load and from now on.</b></p>
+<p id="query_review_enable_link"><b><a href="javascript: createCookie('query_review_enabled', '1'); query_review_hide('query_review_enable_link'); alert('Cookie successfully set.');">Enable it</a> on next page load and from now on.</b></p>
View
9 query_reviewer_defaults.yml
@@ -1,4 +1,5 @@
all:
+ enabled: false
inject_view: true
stack_trace_lines: 3
trace_includes_vendor: false
@@ -6,7 +7,7 @@ all:
profiling: enabled
production_data: true
max_safe_key_length: 100
- disable_sql_cache: true
+ disable_sql_cache: true
warn_severity: 3
critical_severity: 7
@@ -31,9 +32,3 @@ all:
development:
enabled: true
-
-production:
- enabled: false
-
-test:
- enabled: false
Something went wrong with that request. Please try again.