On 1/4/06, Ara.T.Howard <[EMAIL PROTECTED]> wrote:
>
> i've got the latest ruby and rails on this box and am seeing that image_tag
> will turn something like
>
>    /foo/bar.jpg
>
> into
>
>    /foo/foo/bar.jpg
>
> in the following situation:
>
>    /ror/foo/public
>
>    /var/www/html/foo -> /var/ror/foo/public/
>
>    image_tag("/foo/bar.jpg")
>
> this is exactly how compute_public_path is written to work:
>
>    def compute_public_path(source, dir, ext)
>      source = "/#{dir}/#{source}" unless source.first == "/" || 
> source.include?(":")
>      source = "#{source}.#{ext}" unless source.include?(".")
>      source = "[EMAIL PROTECTED]" unless %r{^[-a-z]+://} =~ source
>      source = ActionController::Base.asset_host + source unless 
> source.include?(":")
>      source
>    end
>
> can this be correct?  in this line
>
>    source = "[EMAIL PROTECTED]" unless %r{^[-a-z]+://} =~ source
>
> we'll take the url
>
>    /foo/bar.jpg
>
> and prepend /foo onto it again, even though it's already an absolute url.  in
> trying to create a patch i'd like to understand the logic here.
>
> ??
>
> the code that's already adding /foo is the filecolumn plugin (using
> @request.relative_url_root) - which is in error: rails or the plugin?
>
> should urls with relative_url_root already prepended be smoothly handled by
> rails and not added to again, or is the plugin in error by prepending
> something that rails will anyhow?

I think that absolute path is absolute for your application.  So if
your app is in /foo and your image is /foo/bar.jpg, then you just pass
/bar.jpg.  This way you could move the app to root, change
request_relative_root, and all your /bar.jpg urls keep on working.

Just my thoughts...

--
rick
http://techno-weenie.net
_______________________________________________
Rails-core mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to