Skip to content
Browse files

Use #to_file if not nil, otherwise use #read

Shouldn't rely on #exists? here, since #to_file implementation might
change.
  • Loading branch information...
1 parent e12b6e4 commit c39a61ba2bd3059b9fc6d1b41b12c519e69c4b7a @chrisdurtschi chrisdurtschi committed Sep 20, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/carrierwave/storage/fog.rb
View
3 lib/carrierwave/storage/fog.rb
@@ -225,9 +225,10 @@ def size
#
# [Boolean] true on success or raises error
def store(new_file)
+ fog_file = new_file.to_file
@content_type ||= new_file.content_type
@file = directory.files.create({
- :body => new_file.exists? ? new_file.to_file : new_file.read,
+ :body => fog_file ? fog_file : new_file.read,
:content_type => @content_type,
:key => path,
:public => @uploader.fog_public

0 comments on commit c39a61b

Please sign in to comment.
Something went wrong with that request. Please try again.