# File\_column save directory without object id dirname

**URL:** <https://www.ruby-forum.com/t/file-column-save-directory-without-object-id-dirname/69020>\
**Category:** Rails\
**Created:** [September 18, 2006, 5:46am UTC](https://www.ruby-forum.com/t/file-column-save-directory-without-object-id-dirname/69020 "2006-09-18T05:46:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/bb73d2/32.png) [@xia](https://www.ruby-forum.com/u/xia)\
**Post date:** [September 18, 2006, 5:46am UTC](https://www.ruby-forum.com/t/file-column-save-directory-without-object-id-dirname/69020/1 "2006-09-18T05:46:23Z")

</div>

Has anyone used file\_column for more ftp type file management? ie, where  
the files are all placed in one directory WITHOUT the object id number  
on the preceding directory?

EG

This

file/filename1.ext  
file/filename2.ext

rather than

upload/1/filename1.ext  
upload/2/filename2.ext

I ask this because we are using FCKeditor which allows users to add  
files from file/. Having multiple subdirectories under this will be  
messy. But we also want the users to be able to manage the files which  
have been uploaded from an admin GUI, and are not sure how file\_column  
will find each item if it is not under the object\_id#/ directory.

Or, does acts\_as\_attachment offer this functionality?

---

<div class="post-metadata">

**Author:** ![xia](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/bb73d2/32.png) [@xia](https://www.ruby-forum.com/u/xia)\
**Post date:** [March 2, 2007, 2:53pm UTC](https://www.ruby-forum.com/t/file-column-save-directory-without-object-id-dirname/69020/2 "2007-03-02T14:53:24Z")

</div>

I had similar problem - i needed to store images relative to user id,  
e.g.  
public/images/users/user\_id/image\_file\_1, image\_file\_2 and so on.

Maybe i did somthing wrong with setting :storage\_dir option in my  
model, but this works for me only when i  
edited _file\_column.rb_

1. 

options[:store\_dir] ||= File.join(options[:root\_path], “users”)

1. 

DEFAULT\_OPTIONS = {  
:root\_path =\> File.join(RAILS\_ROOT, “public”, “images”),  
…  
}  
3)  
options[:base\_url] ||= options[:web\_root] + “users”

but now i have other problem - every time the user creates a new post  
and uploads image, the image previously stored in  
his folder, will be deleted

On Sep 18 2006, 5:46 am, Xia \_\_ [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
