Shouldn't asset tag helpers (like image_tag) be able to return absolute paths without asset_host being set?
Both rely on compute_public_path to generate the path. Depending on the value of its "include_host" argument (always true when called from the image helpers), compute_public_path tries to determine a host to prefix onto the path using the compute_asset_host method. But compute_asset_host only uses the ActionController::Base.asset_host method to find a suitable host. The net result is that only relative paths can be generated unless asset_host has been set. Particularly when generating image and stylesheet tags in ActionMailer, this is a show-stopper: HTML email practically requires absolute URIs. My questions to the group: 1. How acceptable is it that the image tag/path helpers effectively ask for absolute paths, even for pages with a request, where relative tags will work just fine? Should these helpers expose the "include_host" argument of compute_public_path? 2. How acceptable is it that, despite being asked for absolute paths via "include_host", compute_public_path fails to include a host unless ActionController::Base.asset_host is configured? 3. Would a patch to compute_asset_host that returns the root URL (with host/protocol) when asset_host is not set be attractive? The root URL can be determined in several ways, but the most attractive is probably to use the root_url helper -which allows it to work with ActionMailer when default_url_options is set. I've written such a patch, but there are a lot of tests that break because there seems to be an expectation that asset paths be relative, regardless of the setting of "include_host". See it here: http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1015 -Chris (cch1) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
