I need to reference the full url of an image stored in the assets,
this url is passed to fancy box to open it
I build the image path in helper and it get the path
"ceramics/big/c0d0.jpg" "ceramics/big/c0d2.jpg", ...
but I need to get the full url to these image
asset_path("ceramiques/big/c0d0.jpg") =>
"/assets/ceramiques/big/
c0d0.jpg"
but there is no asset_url to get
http://localhost:3000/assets/ceramiques/big/c0d0.jpg
or http://www.mydomain.com/assets/ceramiques/big/c0d0.jpg
thanks for your feedback
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Tim Shaffer
2011-Sep-26 12:15 UTC
Re: Rails 3.1.0 how to pass the full url of an image asset ?
Something like this should do the trick. You can just add this as a helper.
def asset_url(source)
"#{request.protocol}#{request.host}#{asset_path(source)}"
end
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/087dd-enJpUJ.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.