# File\_column giving bad urls

**URL:** <https://www.ruby-forum.com/t/file-column-giving-bad-urls/105802>\
**Category:** Rails\
**Created:** [June 3, 2007, 1:58am UTC](https://www.ruby-forum.com/t/file-column-giving-bad-urls/105802 "2007-06-03T01:58:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![furrot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3da27b/32.png) [@furrot](https://www.ruby-forum.com/u/furrot)\
**Post date:** [June 3, 2007, 1:58am UTC](https://www.ruby-forum.com/t/file-column-giving-bad-urls/105802/1 "2007-06-03T01:58:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![furrot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3da27b/32.png) [@furrot](https://www.ruby-forum.com/u/furrot)\
**Post date:** [June 3, 2007, 2:17am UTC](https://www.ruby-forum.com/t/file-column-giving-bad-urls/105802/2 "2007-06-03T02:17:38Z")

</div>

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](http://localhost:3000/post/image/development/16/image.jpg)

---

<div class="post-metadata">

**Author:** ![furrot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3da27b/32.png) [@furrot](https://www.ruby-forum.com/u/furrot)\
**Post date:** [June 3, 2007, 9:19am UTC](https://www.ruby-forum.com/t/file-column-giving-bad-urls/105802/3 "2007-06-03T09:19:24Z")

</div>

What version?

try url\_for\_file\_column :post, :image, :subdir =\> ‘’

---

<div class="post-metadata">

**Author:** ![furrot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3da27b/32.png) [@furrot](https://www.ruby-forum.com/u/furrot)\
**Post date:** [June 6, 2007, 3:34am UTC](https://www.ruby-forum.com/t/file-column-giving-bad-urls/105802/4 "2007-06-06T03:34:14Z")

</div>

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.
