rails/rails — Issue #3766: url helper with relative_url_root
Author: khoan
Created: 2011-11-26 21:09:35+00:00
State: open

the gist is https://gist.github.com/1390486

```ruby
# So I was trying to use named route helpers in sprockets, and the app was hosted in a subdirectory.
# This is what I came up with. Please share your hackeries.
#
# using named routes in sprocket Rails 3.1
# you can use this in app/assets/javascripts/bam.js.erb
# or any other erb sprocket asset

Rails.application.routes.url_helpers.bam_path(
:script_name => ApplicationController.config.relative_url_root
)
```

any neater solution?