Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to initialize meta_request in an initializer #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

abuisman
Copy link

@abuisman abuisman commented Dec 1, 2016

Inspired by rack-mini-profiler I wanted to be able to conditionally enable and disable meta_request through environment variables.

We have a few tools for benchmarking pages and including them all each time we run our development server is not what we want. With my changes you can make a custom initializer and do this:

  if ENV['USE_RAILS_PANEL']
    require 'meta_request'

    # Initialize manually since we skipped it in the Gemfile
    MetaRequest::initialize!(Rails.application)
  end

The condition can be anything you want really.

I also added some documentation on the matter in de README.

I wasn't sure if you'd even be interested to merge this into the project, so I haven't written the tests yet. Also I think you know better what you want to do with those.

My take is that you can create some sort of group in the rails project under test/functional and then conditionally run using the 'normal' group and the one where meta_request has require: false and use an initializer in that case that does what my example above does.

Anyway. Let me know what you think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant