# File\_column Dynamic directory

**URL:** <https://www.ruby-forum.com/t/file-column-dynamic-directory/51959>\
**Category:** Rails\
**Created:** [January 9, 2006, 6:59pm UTC](https://www.ruby-forum.com/t/file-column-dynamic-directory/51959 "2006-01-09T18:59:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dukael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dukael](https://www.ruby-forum.com/u/dukael)\
**Post date:** [January 9, 2006, 6:59pm UTC](https://www.ruby-forum.com/t/file-column-dynamic-directory/51959/1 "2006-01-09T18:59:08Z")

</div>

I asked this question earlier and did recieve an answer but I am not  
sure Ifully understood the answer as I am getting all sorts of  
errors when trying to implement.

Basically I want to add a layer to the path for my files. I have the  
following set up in my model class:

file\_column :image,  
:store\_dir =\> :dynamic\_dir

def dynamic\_dir  
File.join(field\_options[:root\_path], “picture”,@user.username,  
“image”)  
end

When I run the app I recieve the following error:

undefined method `to\_str’ for :dynamic\_dir:Symbol

This is the code that Kyle sent me in reply to my original question:

class Model #…  
file\_column :field, :store\_dir = \> :dynamic\_dir

def dynamic\_dir  
File.join(field\_options[:root\_path], “model\_name”,  
Digest::SHA1.hexdigest(User.current\_user.hash)[0…9], “field\_name”)  
#…

I also tried it with replacing my variable (user.companyname) with  
“test” and that does not work either. I have the trunk version of  
file\_column running on my machine.

Thanks for the help

Andrew

---

<div class="post-metadata">

**Author:** ![dukael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dukael](https://www.ruby-forum.com/u/dukael)\
**Post date:** [January 9, 2006, 7:32pm UTC](https://www.ruby-forum.com/t/file-column-dynamic-directory/51959/2 "2006-01-09T19:32:24Z")

</div>

On 1/9/06, Andrew F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> def dynamic\_dir  
> class Model #…
> 
> Thanks for the help
> 
> Andrew
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Can you paste the full error trace?

–  
Kyle M.  
Chief Technologist  
E Factor Media // FN Interactive  
removed\_email\_address@domain.invalid  
1-866-263-3261

---

<div class="post-metadata">

**Author:** ![dukael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dukael](https://www.ruby-forum.com/u/dukael)\
**Post date:** [January 9, 2006, 9:02pm UTC](https://www.ruby-forum.com/t/file-column-dynamic-directory/51959/3 "2006-01-09T21:02:56Z")

</div>

Kyle,  
here is the full trace:

/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/1.8/fileutils.rb:841:in `fu_list' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/1.8/fileutils.rb:841:in`map’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/1.8/fileutils.rb:841:in `fu_list' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/1.8/fileutils.rb:173:in`mkpath’  
#{RAILS\_ROOT}/vendor/plugins/file\_column/lib/file\_column.rb:25:in  
`init_options' #{RAILS_ROOT}/vendor/plugins/file_column/lib/file_column.rb:549:in`file\_column’  
#{RAILS\_ROOT}/app/models/episode.rb:4  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/  
active\_support/dependencies.rb:207:in `load' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/ active_support/dependencies.rb:207:in`load’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/  
active\_support/dependencies.rb:39:in `require_or_load' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/ active_support/dependencies.rb:22:in`depend\_on’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/  
active\_support/dependencies.rb:30:in `associate_with' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/ active_support/dependencies.rb:179:in`require\_association’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/  
active\_support/dependencies.rb:179:in `require_association' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/ active_record/associations.rb:780:in`require\_association\_class’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/  
active\_record/associations.rb:355:in `has_many_without_reflection' (eval):5:in`has\_many’  
#{RAILS\_ROOT}/app/models/podcast.rb:3  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/  
active\_support/dependencies.rb:207:in `load' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/ active_support/dependencies.rb:207:in`load’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/  
active\_support/dependencies.rb:39:in `require_or_load' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/ active_support/dependencies.rb:22:in`depend\_on’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/  
active\_support/dependencies.rb:30:in `associate_with' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/ active_support/dependencies.rb:179:in`require\_association’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/  
active\_support/dependencies.rb:179:in `require_association' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/ active_record/associations.rb:780:in`require\_association\_class’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/  
active\_record/associations.rb:355:in `has_many_without_reflection' (eval):5:in`has\_many’  
#{RAILS\_ROOT}/app/models/user.rb:6  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/  
active\_support/dependencies.rb:207:in `load' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/ active_support/dependencies.rb:207:in`load’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/  
active\_support/dependencies.rb:39:in `require_or_load' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/ active_support/dependencies.rb:22:in`depend\_on’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/  
active\_support/dependencies.rb:178:in `require_dependency' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/ active_support/dependencies.rb:178:in`require\_dependency’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/  
active\_support/dependencies.rb:194:in `const_missing' #{RAILS_ROOT}/lib/account_system.rb:82:in`app\_config’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
action\_controller/filters.rb:354:in `send' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ action_controller/filters.rb:354:in`call\_filters’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
action\_controller/filters.rb:350:in `each' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ action_controller/filters.rb:350:in`call\_filters’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
action\_controller/filters.rb:339:in `before_action' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ action_controller/filters.rb:331:in`perform\_action\_without\_benchmark’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
action\_controller/benchmarking.rb:69:in `perform_action_without_rescue' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ action_controller/benchmarking.rb:69:in`measure’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
action\_controller/benchmarking.rb:69:in `perform_action_without_rescue' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ action_controller/rescue.rb:82:in`perform\_action’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
action\_controller/base.rb:369:in `send' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ action_controller/base.rb:369:in`process\_without\_session\_management\_support’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
action\_controller/session\_management.rb:116:in `process' #{RAILS_ROOT}/app/controllers/application.rb:15:in`process’  
#{RAILS\_ROOT}/app/controllers/application.rb:14:in `catch' #{RAILS_ROOT}/app/controllers/application.rb:14:in`process’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:  
38:in `dispatch' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/ fcgi_handler.rb:141:in`process\_request’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/  
fcgi\_handler.rb:53:in `process!' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/ fcgi_handler.rb:52:in`each\_cgi’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:597:in  
`each' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:597:in`each\_cgi’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/  
fcgi\_handler.rb:52:in `process!' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/ fcgi_handler.rb:22:in`process!’  
/Users/flip/Documents/workspace/SolidPodcast/public/dispatch.fcgi:24

This error occured while loading the following files:  
user.rb  
podcast.rb  
episode.rb

---

<div class="post-metadata">

**Author:** ![dukael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dukael](https://www.ruby-forum.com/u/dukael)\
**Post date:** [January 9, 2006, 9:36pm UTC](https://www.ruby-forum.com/t/file-column-dynamic-directory/51959/4 "2006-01-09T21:36:16Z")

</div>

On 1/9/06, Andrew F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Resources/ports/lib/ruby/1.8/fileutils.rb:841:in `fu_list' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ active_support/dependencies.rb:30:in `associate\_with’  
> Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/  
> Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/  
> /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
> /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
> active\_support/dependencies.rb:22:in `depend_on' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ action_controller/filters.rb:350:in `call\_filters’  
> Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
> /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
> Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:  
> /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
> fcgi\_handler.rb:22:in `process!’  
> On Jan 9, 2006, at 1:31 PM, Kyle M. wrote:
> 
> > > ```
> > > :store_dir => :dynamic_dir
> > > 
> > > ```
> > > 
> > > This is the code that Kyle sent me in reply to my original question:  
> > > “test” and that does not work either. I have the trunk version of
> > 
> > Rails mailing list  
> > removed\_email\_address@domain.invalid  
> > [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

It doesn’t look like you are using the most current version of the  
trunk. Can you update and verify that you are using version \>= 53?

–  
Kyle M.  
Chief Technologist  
E Factor Media // FN Interactive  
removed\_email\_address@domain.invalid  
1-866-263-3261

---

<div class="post-metadata">

**Author:** ![dukael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dukael](https://www.ruby-forum.com/u/dukael)\
**Post date:** [January 9, 2006, 10:09pm UTC](https://www.ruby-forum.com/t/file-column-dynamic-directory/51959/5 "2006-01-09T22:09:37Z")

</div>

That sort of worked. I now receive the following error:

undefined local variable or method `field\_options’ for #\<Episode:  
0x24b8af4\>

I completely removed my old file\_column instance and than installed  
new. I am on revision 3 now. I also tried just options. Sorry if this  
is something that I am doing wrong still slowly wrapping my brain  
around rails.

here is the full trace as well:

/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/  
active\_record/base.rb:1501:in `method_missing' #{RAILS_ROOT}/app/models/episode.rb:10:in`dynamic\_dir’  
#{RAILS\_ROOT}/vendor/plugins/file\_column/lib/file\_column.rb:116:in  
`send' #{RAILS_ROOT}/vendor/plugins/file_column/lib/file_column.rb:116:in`store\_dir’  
#{RAILS\_ROOT}/vendor/plugins/file\_column/lib/file\_column.rb:128:in  
`tmp_base_dir' #{RAILS_ROOT}/vendor/plugins/file_column/lib/file_column.rb:215:in`store\_upload’  
#{RAILS\_ROOT}/vendor/plugins/file\_column/lib/file\_column.rb:150:in  
`upload' #{RAILS_ROOT}/vendor/plugins/file_column/lib/file_column.rb:70:in`assign’  
#{RAILS\_ROOT}/vendor/plugins/file\_column/lib/file\_column.rb:656:in  
`audio=' #{RAILS_ROOT}/vendor/plugins/file_column/lib/file_column.rb:655:in`audio=’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/  
active\_record/base.rb:1337:in `send' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/ active_record/base.rb:1337:in`attributes=’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/  
active\_record/base.rb:1336:in `each' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/ active_record/base.rb:1336:in`attributes=’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/  
active\_record/base.rb:1188:in `initialize_without_callbacks' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/ active_record/callbacks.rb:236:in`initialize’  
#{RAILS\_ROOT}/app/controllers/episodes\_controller.rb:36:in `new' #{RAILS_ROOT}/app/controllers/episodes_controller.rb:36:in`create’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
action\_controller/base.rb:853:in `send' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ action_controller/base.rb:853:in`perform\_action\_without\_filters’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
action\_controller/filters.rb:332:in `perform_action_without_benchmark' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ action_controller/benchmarking.rb:69:in`perform\_action\_without\_rescue’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
action\_controller/benchmarking.rb:69:in `measure' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ action_controller/benchmarking.rb:69:in`perform\_action\_without\_rescue’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
action\_controller/rescue.rb:82:in `perform_action' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ action_controller/base.rb:369:in`send’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
action\_controller/base.rb:369:in  
`process_without_session_management_support' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ action_controller/session_management.rb:116:in`process’  
#{RAILS\_ROOT}/app/controllers/application.rb:15:in `process' #{RAILS_ROOT}/app/controllers/application.rb:14:in`catch’  
#{RAILS\_ROOT}/app/controllers/application.rb:14:in `process' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb: 38:in`dispatch’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/  
fcgi\_handler.rb:141:in `process_request' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/ fcgi_handler.rb:53:in`process!’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/  
fcgi\_handler.rb:52:in `each_cgi' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:597:in`each’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:597:in  
`each_cgi' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/ fcgi_handler.rb:52:in`process!’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/  
fcgi\_handler.rb:22:in `process!’  
/Users/flip/Documents/workspace/SolidPodcast/public/dispatch.fcgi:24

Andrew

---

<div class="post-metadata">

**Author:** ![dukael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dukael](https://www.ruby-forum.com/u/dukael)\
**Post date:** [January 9, 2006, 10:28pm UTC](https://www.ruby-forum.com/t/file-column-dynamic-directory/51959/6 "2006-01-09T22:28:00Z")

</div>

Thanks, wasn’t sure if it was me or file\_column. I will work on  
figuring out what is going on with my dynamic\_dir method now.

Andrew

---

<div class="post-metadata">

**Author:** ![dukael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dukael](https://www.ruby-forum.com/u/dukael)\
**Post date:** [January 9, 2006, 10:21pm UTC](https://www.ruby-forum.com/t/file-column-dynamic-directory/51959/7 "2006-01-09T22:21:57Z")

</div>

On 1/9/06, Andrew F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> #{RAILS\_ROOT}/vendor/plugins/file\_column/lib/file\_column.rb:128:in  
> `audio=' Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/ Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ action_controller/base.rb:369:in `send’  
> /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
> fcgi\_handler.rb:52:in `each\_cgi’  
> Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/
> 
> > > Kyle,  
> > > /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
> > > Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/  
> > > /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
> > > active\_record/associations.rb:355:in `has_many_without_reflection' active_support/dependencies.rb:39:in `require\_or\_load’  
> > > Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/  
> > > Resources/ports/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/  
> > > /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
> > > Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
> > > /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
> > > /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
> > > Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
> > > #{RAILS\_ROOT}/app/controllers/application.rb:14:in `process’  
> > > Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/  
> > > /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/
> > > 
> > > > > the
> > > > > 
> > > > > def dynamic\_dir  
> > > > > Andrew  
> > > > > Kyle M.  
> > > > > Rails mailing list  
> > > > > E Factor Media // FN Interactive  
> > > > > [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

File\_column is responding correctly, but there’s a bug within your  
dynamic\_dir method. For debugging help, I recommend the IRC channel.

–  
Kyle M.  
Chief Technologist  
E Factor Media // FN Interactive  
removed\_email\_address@domain.invalid  
1-866-263-3261

---

<div class="post-metadata">

**Author:** ![dukael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dukael](https://www.ruby-forum.com/u/dukael)\
**Post date:** [January 10, 2006, 10:41pm UTC](https://www.ruby-forum.com/t/file-column-dynamic-directory/51959/8 "2006-01-10T22:41:40Z")

</div>

Figured I would post this as a workaround and if I have time I will  
go through the file\_column code a bit more to try and patch it. But I  
found the solution to my dynamic directory issue. It is definitely a  
file\_column thing.

After getting my dynamic\_dir method to work I was running into the  
following error: (Removed the info about the railsroot directory but  
the full path was there)

No such file or directory - /{RAILS\_ROOT}/public/episode/1/audio/tmp/  
1136928177.355831.270

This error came from the following method:

def dynamic\_dir  
File.join(“episode”,self.user\_id,“audio”)  
end

The call to file\_column looks like this:

file\_column :audio,  
:permission =\> 0664,  
:store\_dir =\> :dynamic\_dir

and here is the full app error trace for those that care:

/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/1.8/fileutils.rb:525:in `stat' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/1.8/fileutils.rb:525:in`stat’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/1.8/fileutils.rb:511:in `preserve' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/1.8/fileutils.rb:455:in`copy\_entry’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/1.8/fileutils.rb:416:in `copy_entry' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/1.8/fileutils.rb:584:in`mv’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/1.8/fileutils.rb:572:in `fu_each_src_dest' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/1.8/fileutils.rb:845:in`fu\_each\_src\_dest0’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/1.8/fileutils.rb:845:in `fu_each_src_dest' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/1.8/fileutils.rb:572:in`mv’  
#{RAILS\_ROOT}/vendor/plugins/trunk/lib/file\_column.rb:365:in `move_from' #{RAILS_ROOT}/vendor/plugins/trunk/lib/file_column.rb:314:in`after\_save’  
#{RAILS\_ROOT}/vendor/plugins/trunk/lib/file\_column.rb:676:in  
`audio_after_save' #{RAILS_ROOT}/vendor/plugins/trunk/lib/file_column.rb:675:in`audio\_after\_save’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/  
active\_record/callbacks.rb:333:in `send' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/ active_record/callbacks.rb:333:in`callback’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/  
active\_record/callbacks.rb:330:in `each' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/ active_record/callbacks.rb:330:in`callback’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/  
active\_record/callbacks.rb:250:in `create_or_update' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/ active_record/base.rb:1226:in`save\_without\_validation’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/  
active\_record/validations.rb:698:in `save_without_transactions' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/ active_record/transactions.rb:126:in`save’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/  
active\_record/transactions.rb:126:in `transaction' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/ active_record/transactions.rb:91:in`transaction’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/  
active\_record/transactions.rb:118:in `transaction' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/ active_record/transactions.rb:126:in`save’  
#{RAILS\_ROOT}/app/controllers/episodes\_controller.rb:39:in `create' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ action_controller/base.rb:853:in`send’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
action\_controller/base.rb:853:in `perform_action_without_filters' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ action_controller/filters.rb:332:in`perform\_action\_without\_benchmark’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
action\_controller/benchmarking.rb:69:in `perform_action_without_rescue' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ action_controller/benchmarking.rb:69:in`measure’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
action\_controller/benchmarking.rb:69:in `perform_action_without_rescue' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ action_controller/rescue.rb:82:in`perform\_action’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
action\_controller/base.rb:369:in `send' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/ action_controller/base.rb:369:in`process\_without\_session\_management\_support’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/  
action\_controller/session\_management.rb:116:in `process' #{RAILS_ROOT}/app/controllers/application.rb:15:in`process’  
#{RAILS\_ROOT}/app/controllers/application.rb:14:in `catch' #{RAILS_ROOT}/app/controllers/application.rb:14:in`process’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:  
38:in `dispatch' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/ fcgi_handler.rb:141:in`process\_request’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/  
fcgi\_handler.rb:53:in `process!' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/ fcgi_handler.rb:52:in`each\_cgi’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:597:in  
`each' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:597:in`each\_cgi’  
/Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/  
Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/  
fcgi\_handler.rb:52:in `process!' /Applications/Locomotive/Bundles/rails-1.0.0-max.bundle/Contents/ Resources/ports/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/ fcgi_handler.rb:22:in`process!’  
/Users/flip/Documents/workspace/SolidPodcast/public/dispatch.fcgi:24

Now on to the workaround. I figured that there was something going on  
with the temp\_dir settings and decided to test it out by defining the  
temp directory myself. The new file\_column call looks like this:

file\_column :audio,  
:permission =\> 0664,  
:store\_dir =\> :dynamic\_dir,  
:tmp\_base\_dir =\> “/episode/tmp”

The permission really doesnt matter. What does is the tmp\_base\_dir.  
As the stack shows something is going on when creating the temp  
directory as file\_column blows up when trying to implement the  
after\_save\_method found at line 675 of the trunk version. It blows up  
because the temp directory is never created, since it is never  
created the file is never saved and therefore can’t be moved to the  
permanent directory.

By over riding the tmp directory settings I am able to upload files  
that are stored where i want them to be stored with the added layer  
of by user.

Like I said I will try to carve some time out to look into this more  
and come up with a patch to submit for file\_column but until than or  
if someone else figures out why this acts the way it does and you  
need to have a dynamic directory than this is the workaround to the  
issue.

Thanks for all the lists help again I know that I have had several  
questions with some great responses on this list. I wish all  
communities were this helpful.

Andrew
