This project is archived and is in readonly mode.
image_path helper won't generate absolute paths without asset_host
-
Chris Hapgood
Attached patch to solve problem. Tests coming next...
-
Michael Koziarski
- Assigned user set to Pratik
-
Chris Hapgood
When I wrote this changeset up on the mailing list, nobody replied. No positive replies, no negative replies. So I'm led to believe that with ActionMailer people are either using an asset host or they have alternative workarounds to get linked images.
In either case, the lack of interest has made me put my work into other issues for the time being. I'll try to get back to this ticket if you think it's worthwhile. Otherwise, let's close it. -Chris
-
Pratik
- State changed from incomplete to hold
Let's keep it on 'hold' for now and tackle it post 2.2 ( or till someone else faces the problem).
-
Jonathan del Strother
I for one would like to see this fixed. The attached patch is a little cleaner than the original and includes a test.
Any thoughts on the use of root_url for computing this? Seems a little weird to be relying on something that may or may not be defined in routes, but I'm not sure there's a better way...
-
Pratik
- Milestone cleared.
- State changed from hold to open
-
Pratik
- Milestone cleared.
-
Pratik
Umm, why can't we use default_url_options[:host] ?
-
Pratik
- Milestone set to 2.x
-
Marko
I'm building newsletter now and this would be very useful feature.
-
Gregory Tomei
+1 I would like to have absolute URLs possible in image_tag also
-
Ryan Sandridge
Specifying default_url_options[:host] in ActionMailer does not result in absolute image tags (or I'm doing something wrong).
-
gonzoyumo
Hi
+1 too. Still stuck with html emails. would be intresting to have such a feature.
what about it ?
-
masone
- Importance changed from to
Regarding Jonathan del Strothers patch.
- The patch does not apply to master, but it does apply to 2-3-stable.
- Tests do pass on 2-3-stable
I personally think that the current behavior is perfectly fine. There is no asset host defined, so there is no absolute asset path. The behaviour only becomes obvious when you use the helper in mailer templates. The same problem applies to url_for too by the way.
I don't like the idea of using the root_url as a fallback. It just doesn't feel right to me. And I don't think that it's a good idea to rely the implementation on route helpers.
There are a few things I would reconsider:
- Is there really the need for a change? Just setting the asset host would do the trick.
- Find a generic solution that also fixes the url_for helper, not just the asset tag.
- Think about an other solution than using root_url.
- Return host instead of nil since that would match the behavior on line 577 (host would be nil in that case anyway)
-
Jarl Friis
I would like to see something like
ActionView::Helpers::AssetTagHelper#image_urlthat returns the absolute url in stead of just the path asActionView::Helpers::AssetTagHelper#image_pathdoes.Jarl
-
Jarl Friis
I see am not the only one that have a wish for
#image_url:
http://groups.google.com/group/rubyonrails-talk/browse_thread/threa... -
Santiago Pastorino
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino
- State changed from open to stale
-
Greg Hazel
The wish for this to be fixed still exists. Using default_url_options[:host] seems like a reasonable answer.
[state:open]
