Forum: Ruby on Rails getcwd not found: rails 1.1.6, file_column (svn)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
56d3edaa29274d0eedbfc7a93b868fd7?d=identicon&s=25 nov (Guest)
on 2007-06-14 13:39
(Received via mailing list)
Hi,

I get an "Errno::ENOENT No such file or directory - getcwd", after
finishing an upload process by the file_column plugin, and just before
a redirection.

The action which receives the POST with the upload information is

   def presentation
     (...)
     save_file(@presentation, params[:presentation])
     (...)
     redirect_to :action => 'admin'
   end

If I comment the save_file statement, redirect_to works, and no file
is uploaded, as expected. If I leave it uncommented, that's what it is
supposed to do:

  def save_file(array, parameters)
    if array.update_attributes(parameters)
      name = File.basename(array.file)
      name.gsub(/[^\w._-]/,'')
      array.name = name
      if array.save
      else
        flash[:notice] = "Error: array.save"
        return false
      end
    else
      flash[:notice] = "Error: array.update_attributes"
      return false
    end
  return true
  end

What it happens, instead, is: the file is uploaded, the database is
filled, but something goes wrong as the ENOENT error message appears
before the redirection is completed. I must restart lighttpd to reach
again the app.

It's really a weird problem. I have another file upload field under
the same controller and it just works fine...

The exception, exactly, claims:

Errno::ENOENT
No such file or directory - getcwd
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/routing.rb:269:in `expand_path'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/routing.rb:269:in `safe_load_paths'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/routing.rb:268:in `select'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/routing.rb:268:in `safe_load_paths'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/routing.rb:281:in `attempt_load'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/routing.rb:237:in `traverse_to_controller'
generated/routing/recognition.rb:3:in `recognize_path'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/routing.rb:511:in `recognize!'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in
`dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:
150:in `process_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:
54:in `process!'
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:600:in `each_cgi'
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:117:in `session'
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:104:in `each_request'
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:36:in `each'
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:
53:in `process!'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:
23:in `process!'

I don't know if it has to do with the safe_load_paths in routing.rb of
actionpack-1.12.5...  if I should then upgrade to 1.2.3 of if there's
something I'm missing.

I've someone has encountered something similar, any help or insight is
much appreciated.

Thank you,
 abelardo
This topic is locked and can not be replied to.