Created
November 24, 2011 02:18
-
-
Save khoan/1390486 to your computer and use it in GitHub Desktop.
Rails 3.1 url helper in sprockets with relative_url_root
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment