Strange urls from url_for_file_column

Hi;

I got file_column working, but when I try

<%= image_tag url_for_file_column(“artifact”, “image”) %>

the resulting url generated is:

/unworld/unworld/artifact/image/1/dome.jpg

My document root for my rails application is
http://www.mydomain.com/unworld

and the true path to the image is

http://www.mydomain.com/unworld/artifact/image/1/dome.jpg

… 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?

tia

-sporb

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

end

As I get better at this, i’ll, one day, know why… :slight_smile:

-sporb

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs