# File\_column creates tmp images, but not actual

**URL:** <https://www.ruby-forum.com/t/file-column-creates-tmp-images-but-not-actual/50038>\
**Category:** Rails\
**Created:** [November 18, 2005, 6:50pm UTC](https://www.ruby-forum.com/t/file-column-creates-tmp-images-but-not-actual/50038 "2005-11-18T18:50:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![i8ramin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/e36b37/32.png) [@i8ramin](https://www.ruby-forum.com/u/i8ramin)\
**Post date:** [November 18, 2005, 6:50pm UTC](https://www.ruby-forum.com/t/file-column-creates-tmp-images-but-not-actual/50038/1 "2005-11-18T18:50:08Z")

</div>

I am having a slight problem with file\_column. I’ve defined everything  
according to the documentation but for some odd reason, only the tmp  
files  
are being uploaded. the permanent ones are never created.

my Model code:  
class User \< ActiveRecord::Base  
file\_column :image, :store\_dir =\> ‘public/users’, :magick =\> { :versions  
=\>  
{ ‘thumb’ =\> ‘50\>’, ‘profile’ =\> ‘200\>’ } }  
end

my View code:  
\<%= file\_column\_field ‘user’, ‘image’ %\>

\<% if not @user.image.nil? %\>

\<%= image\_tag url\_for\_file\_column("user", "image", "profile"), :alt =\> @user.login %\>
\<% end %\>

All view code works just fine and the actual image tag is created with  
the  
proper image path. but the image doesn’t exist in that path cause it’s  
never  
created (or moved/copied from the tmp folder)

my Table column definition for image:  
image VARCHAR(50) default NULL,

These files get created just fine:  
$RAILS\_ROOT/public/users/tmp//filename.ext  
$RAILS\_ROOT/public/users/tmp//filename-profile.ext  
$RAILS\_ROOT/public/users/tmp//filename-thumb.ext

But, they are never moved/copied to the permanent location of  
$RAILS\_ROOT/public/users//\<object.id [http://object.id](http://object.id)

> /filename.ext

What’s going on here?! I don’t think its a problem with permissions,  
cause  
i’m running Webrick and the tmp folder and files get created just fine.

---

<div class="post-metadata">

**Author:** ![i8ramin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/e36b37/32.png) [@i8ramin](https://www.ruby-forum.com/u/i8ramin)\
**Post date:** [November 18, 2005, 11:22pm UTC](https://www.ruby-forum.com/t/file-column-creates-tmp-images-but-not-actual/50038/2 "2005-11-18T23:22:05Z")

</div>

Hmmm… I decided to make my Profile object have the image column as  
opposed  
to my User object and everything seems to be working fine now. I don’t  
understand why though. All I did was set the image column to the Profile  
model instead of the User model. Very strange.

---

<div class="post-metadata">

**Author:** ![i8ramin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/e36b37/32.png) [@i8ramin](https://www.ruby-forum.com/u/i8ramin)\
**Post date:** [November 19, 2005, 2:09pm UTC](https://www.ruby-forum.com/t/file-column-creates-tmp-images-but-not-actual/50038/3 "2005-11-19T14:09:16Z")

</div>

my wild newbie guess would be that perhaps there’s some conflict with  
using “image” as the “user” file\_column, for some reason? I seem to  
remember having problems before using “file” as the file\_column, and  
having to change it to another name.

2005/11/18, Ramin [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
