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