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

Doesnt Seem to be working with Mountable Rails engines #178

Open
shshankjain opened this issue Jul 24, 2013 · 4 comments
Open

Doesnt Seem to be working with Mountable Rails engines #178

shshankjain opened this issue Jul 24, 2013 · 4 comments

Comments

@shshankjain
Copy link

I am able to get it working in the development environment with basic pages (root level). But when I navigate inside a Rails (mountable) engine, I stop seeing miniprofiler data.

The moment I go back to application root, I can see multiple miniprofiler badges with data.

Changing the below in https://github.com/SamSaffron/MiniProfiler/blob/master/Ruby/lib/mini_profiler/profiler.rb#L509

    def get_profile_script(env)
      ids = ids_comma_separated(env)
      path = "#{env['SCRIPT_NAME']}#{@config.base_url_path}"

to

    def get_profile_script(env)
      ids = ids_comma_separated(env)
      # Could be done better for applications which are deployed under non root context
      path = "#{@config.base_url_path}"

Fixes the issue.

Note : Using rails (3.2.12)

@SamSaffron
Copy link
Owner

Will this break subdirectroy based rails installs though? care to give a full fix a shot, I don't really want to fix this just to break other cases.

@mozcomp
Copy link

mozcomp commented Aug 1, 2013

This was a major headache for me using a plethora of mountable engines. Thanks for finding a little fix - even if it has caused some more breaks elsewhere? I haven't seen any problems yet.

@mjc
Copy link

mjc commented Sep 11, 2013

@SamSaffron looks like rails4 mangles the SCRIPT_NAME based on the engine's mounted location so it's not an accurate method of getting the base.

rails/rails@5b3bb61

Perhaps it would be ideal to append env['SCRIPT_NAME'] to the default base_url_path instead of appending it to all base_url_paths, so that if people need to override it, they can do so without patching miniprofiler?

@SamSaffron
Copy link
Owner

sure, care to try a PR for it?

On Thu, Sep 12, 2013 at 6:59 AM, Michael J. Cohen
[email protected]:

@SamSaffron https://github.com/SamSaffron looks like rails4 mangles the
SCRIPT_NAME based on the engine's mounted location so it's not an
accurate method of getting the base.

rails/rails@5b3bb61rails/rails@5b3bb61

Perhaps it would be ideal to append env['SCRIPT_NAME'] to the default
base_url_path instead of appending it to all base_url_paths, so that if
people need to override it, they can do so without patching miniprofiler?


Reply to this email directly or view it on GitHubhttps://github.com//issues/178#issuecomment-24275889
.

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

No branches or pull requests

4 participants