brentd/xray-rails — pull request #14 by joshuaflanagan (2013-05-10 20:00:45+00:00)
Title: Work with applications that configure action_controller.relative_url_root

The references to xray.js and xray-backbone.js were generated by helpers that did not account for the current application configuration.

Specifically, if your application configured:

config.action_controller.relative_url_root = '/dummy'

the generated link would be:

```

```

That reference is invalid, so the file request would 404, and the user would be left without xray functionality (Command-Shift-X does nothing).

Instead of using the helpers from ActionController::Base, I attempt to approximate the helper used by the view by using `#javascript_include_tag` from Sprockets. After the change, the generated link is corrected and resolves:

```

```

I'm not completely comfortable that my #view_context implementation in the middleware is the best it could be, but it works. Someone more familiar with the ActionController/ActionView/ViewContext interplay may be able to improve it.