I'm using Rails 3.1. I'm trying to figure this out, and to my surprise, it is starting to seem that rails does not come with this method at all. Maybe im wrong.
Can anyone show how I can get a full absolute URL to an image?
I use asset_path(image.png)
which gives me the relative path to use within the app. I tried doing a root_url + asset_path(image.png)
but that just gives me a http://localhost:3000//assets/image.png
with the double slashes
Anyone have an efficient way of doing this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…