File_column: No such file or directory

Hi All -

I just installed file_column and am trying to make the simplest example
work. I have one file upload control and I’m getting the following
puzzling error.

It’s complaining about a missing file or directory, but the first
directory in the error exists. The second one doesn’t because it’s not
supposed to, I’m renaming the first directory to the second one. The
model containing the image column is property, and the column is called
image. Has anybody seen this? Thanks for any help!

I’m running ruby 1.8.6 and rails 2.0.2.

Errno::ENOENT (No such file or directory -
/home/sline/deployed/happycanyon/releases/20080503044201/public/property/image/tmp/1209794023.471088.30819
or
/home/sline/deployed/happycanyon/releases/20080503044201/public/property/image/production/1):
/usr/local/lib/ruby/1.8/fileutils.rb:505:in rename' /usr/local/lib/ruby/1.8/fileutils.rb:505:inmv’
/usr/local/lib/ruby/1.8/fileutils.rb:1395:in fu_each_src_dest' /usr/local/lib/ruby/1.8/fileutils.rb:1411:infu_each_src_dest0’
/usr/local/lib/ruby/1.8/fileutils.rb:1393:in fu_each_src_dest' /usr/local/lib/ruby/1.8/fileutils.rb:494:inmv’
/vendor/plugins/rails_file_column/plugins/file_column/trunk/lib/file_column.rb:364:in
move_from' /vendor/plugins/rails_file_column/plugins/file_column/trunk/lib/file_column.rb:310:inafter_save’
/vendor/plugins/rails_file_column/plugins/file_column/trunk/lib/file_column.rb:676:in
image_after_save' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:307:insend’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:307:in
callback' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:304:ineach’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:304:in
callback' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:214:increate_or_update’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1972:in
save_without_validation' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/validations.rb:934:insave_without_transactions’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in
save' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:intransaction’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:80:in
transaction' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:100:intransaction’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in
save' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:120:inrollback_active_record_state!’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in
save' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2034:inupdate_attributes’
/app/controllers/property_controller.rb:41:in update' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:insend’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in
perform_action_without_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:incall_filters’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in
`perform_action_without_benchmark’

Errno::ENOENT (No such file or directory -
/home/sline/deployed/happycanyon/releases/20080503044201/public/property/image/tmp/1209794023.471088.30819
or

/home/sline/deployed/happycanyon/releases/20080503044201/public/property/image/production/1):

Check permission folder to those addresses, ensure that they are 755

Reinhart
http://teapoci.blogspot.com

Oh boy, it’s amazing what a half a night of sleep can do for solving
software problems. Wonder what a full night of sleep would do?

The error was because one of the intermediate directories in the
destination directory name wasn’t present. I may hack my copy of
file_column to create the destination directory with all intermediate
components before the move.

Steve

submit a patch, I guess :slight_smile:
-R

On Sat, May 3, 2008 at 7:39 AM, Steven L.

Here’s the change I made in file_column.rb:

def move_from(local_dir, just_uploaded)

#start new code
dirname = File.dirname(@dir) # dirname of parent dir
if not File.directory?(dirname)
FileUtils.mkdir_p dirname # if intermediate dirs are missing,
create them
end
#end new code

  # remove old permament dir first
  # this creates a short moment, where neither the old nor
  # the new files exist but we can't do much about this as
  # filesystems aren't transactional.
  FileUtils.rm_rf @dir # remove last component of path

  FileUtils.move local_dir, @dir

  @just_uploaded = just_uploaded
end

I had the same problem man!

Thank’s for solving it! it was impossible for me.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs