File_column giving bad urls

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.

I made an error in my post since I couldn’t get my server started. The
bad URL it is outputting is
http://localhost:3000/post/image/development/16/image.jpg

What version?

try url_for_file_column :post, :image, :subdir => ‘’

Keynan P. 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 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