File_column mangling URL


#1

Hey,

I’ve gotten file_column to upload a file, drop it in the dynamic
directory, but I can’t display the image, the directories repeat
themselves:

My model:

class Person < ActiveRecord::Base
file_column :image_url

In my view:

<%= image_tag url_for_file_column(‘person’, ‘image_url’) %>

HTML generated is this:

Male_face

There shouldn’t be two ‘/dhcp/public’ there.

  • Nic

#2

On 1/16/06, Nic W. removed_email_address@domain.invalid wrote:

  • Nic

Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

I know that with the addition of named routes, Rails uses xxxx_url,
and possibly either reserves it, or attaches magic functionality.
What happens when you rename your field?


Kyle M.
Chief Technologist
E Factor Media // FN Interactive
removed_email_address@domain.invalid
1-866-263-3261


#3

Thanks, that fixed part of the problem - I can use image_tag, but not
the url_for_file_column version:

<%= image_tag(@person[‘image’]) %> *** WORKS ***
<%= image_tag url_for_file_column(‘person’, ‘image’) %> *** SAME PROBLEM


I guess I’ll just use the original image_tag, thanks!

  • Nic.

On 1/16/06, Kyle M. removed_email_address@domain.invalid wrote:

    file_column      :image_url

There shouldn’t be two ‘/dhcp/public’ there.
and possibly either reserves it, or attaches magic functionality.
Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

  • Nic

#4

Actually, that doesn’t work, because image_tag just looked in /images,
where I happened to have the same jpg.

I need to use image_tag url_for_file_column to point to the dynamic
directory, but it repeats the /dhcp/public twice:

Werner

Anybody have any thoughts?

On 1/16/06, Nic W. removed_email_address@domain.invalid wrote:

On 1/16/06, Kyle M. removed_email_address@domain.invalid wrote:

    file_column      :image_url

There shouldn’t be two ‘/dhcp/public’ there.
and possibly either reserves it, or attaches magic functionality.
Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

  • Nic

  • Nic

#5

Hey Nic,

On 1/17/06, Nic W. removed_email_address@domain.invalid wrote:

<%= image_tag url_for_file_column(‘person’, ‘image_url’) %>

HTML generated is this:

Male_face

There shouldn’t be two ‘/dhcp/public’ there.

Is your rails app deployed at a sub-path (e.g., not directly at
top-level)? file_column has some issues here, that I’m currently
working on (Ara did some debugging, I just have to catch up).

Sebastian


#6

Hey Sebastian,

It is displayed at sub-path, meaning I have WebRoot as the top level
for Apache, and then the app ‘dhcp’ is off of that, making it:

/dhcp/public/person/image/1/male_face.jpg

Is that what you’re referring to?

Thanks for the response, this has been holding me back. I’ll try
pointing Apache at the app and see if that makes a difference

  • Nic.

On 1/18/06, Sebastian K. removed_email_address@domain.invalid wrote:

    file_column      :image_url

There shouldn’t be two ‘/dhcp/public’ there.

  • Nic