Forum: Ruby on Rails file_column giving bad urls

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.
21fb319b1d7c97dadd265c6781534e8b?d=identicon&s=25 Stephen F. (furrot)
on 2007-06-03 01:58
Hi Everyone, I'm currently working on a practice blog project of sorts
and wanted to add an image to each of my posts.  I've downloaded
file_column and installed it since it seems like a good solution for
what I want to do.

My problem is that when I called url_for_filecolumn it returns the wrong
url to my images.  If the image is located at
localhost:3000/public/post/image/16/image.jpg file column returns
localhost:3000/public/development/post/image/16/image.jpg. I tried
switching the env setting to "production" instead but that just changed
it to localhost:3000/public/production/post/image/16/image.jpg.

Also does anyone know how to confirm that it will not return nil if you
call it?  My app keeps crashing when it passes nil to .to_url (sic)
instead of telling me it's nil.  I tried checking if post.image was nil
but that didn't really help either.

Thanks for your help, I'm sure there's something simple I don't know
since I just started out.
21fb319b1d7c97dadd265c6781534e8b?d=identicon&s=25 Stephen F. (furrot)
on 2007-06-03 02:17
I made an error in my post since I couldn't get my server started.  The
bad URL it is outputting is
72eb65fa089082d3bd8b38a5596ad331?d=identicon&s=25 Keynan Pratt (keynan)
on 2007-06-03 09:19
What version?

try url_for_file_column :post, :image, :subdir => ''
21fb319b1d7c97dadd265c6781534e8b?d=identicon&s=25 Stephen F. (furrot)
on 2007-06-06 03:34
Keynan Pratt wrote:
> What version?
> try url_for_file_column :post, :image, :subdir => ''

Thanks for responding.  That didn't seem to change anything.  The urls
still keep getting spit out as
localhost:3000/post/image/development/16/example.jpg.  I've been looking
through the source of file column but haven't found where the RAILS_ENV
value is getting parsed on.  I think the problem might be in
dispatch.fcgi but I'm not sure since I'm just starting out.  There's a
thin line between being really easy and really dangerous.
This topic is locked and can not be replied to.