Forum: Ruby on Rails strange urls from url_for_file_column

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
C341d221fb34832b56dc35bcb2a74afd?d=identicon&s=25 sporb (Guest)
on 2007-01-16 21:29

I got file_column working, but when I try

<%= image_tag url_for_file_column("artifact", "image") %>

the resulting url generated is:


My document root for my rails application is

and the true path to the image is

... so you can see that it appears to be appending the path_to_the_image
to the wrong document root. Can anybody suggest how I might  begin to
debug this?


C341d221fb34832b56dc35bcb2a74afd?d=identicon&s=25 sporb (Guest)
on 2007-01-18 06:19
It's a hack, but:

In file_column_helper.rb

 def url_for_file_column(object_name, method, suffix=nil)
    object = instance_variable_get("@#{object_name.to_s}")
    relative_path = object.send("#{method}_relative_path", suffix)
    return nil unless relative_path
    url = ""
# sporb - comment out the following
#   url << @request.relative_url_root.to_s << "/"
# sporb - add this line
    url << "/"
    url << object.send("#{method}_options")[:base_url] << "/"
    url << relative_path

As I get better at this, i'll, one day, know why... :)

This topic is locked and can not be replied to.