Closed wapcaplet closed 13 years ago
When uploading an avatar photo from social_stream, I get this exception:
TypeError in AvatarsController#create can't convert Array into String Rails.root: /home/eric/git/scss Application Trace | Framework Trace | Full Trace /home/eric/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/fileutils.rb:1431:in `directory?' /home/eric/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/fileutils.rb:1431:in `fu_each_src_dest0' /home/eric/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/fileutils.rb:1416:in `fu_each_src_dest' /home/eric/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/fileutils.rb:391:in `cp' avatars_for_rails (0.0.10) app/models/avatar.rb:58:in `copy_to_temp_file' avatars_for_rails (0.0.10) app/models/avatar.rb:92:in `process_precrop' [....]
I traced the problem to the last line of self.images_tmp_path in app/models/avatar.rb:
self.images_tmp_path
app/models/avatar.rb
tmp_path = FileUtils.mkdir_p(File.join(images_path, "tmp"))
It seems that mkdir_p returns an array of directories, not just one. I fixed it by separating the directory-creation from the return value like this:
mkdir_p
tmp_path = File.join(images_path, "tmp") FileUtils.mkdir_p(tmp_path) return tmp_path
I haven't had this problem before, it seems to be a problem with ruby 1.9. I have included your change and it works perfect. Thanks.
When uploading an avatar photo from social_stream, I get this exception:
I traced the problem to the last line of
self.images_tmp_path
inapp/models/avatar.rb
:It seems that
mkdir_p
returns an array of directories, not just one. I fixed it by separating the directory-creation from the return value like this: