Skip to content
This repository
Browse code

Fix paperclip tempfile detect

  • Loading branch information...
commit 4914510687e90a49ec44cd41cc3a3feb9711d2e5 1 parent a2c3de0
Igor Galeta authored May 14, 2012
5  lib/ckeditor/backend/paperclip.rb
@@ -21,7 +21,10 @@ def self.extended(base)
21 21
       
22 22
       module InstanceMethods
23 23
         def geometry
24  
-          @geometry ||= ::Paperclip::Geometry.from_file(data.to_file)
  24
+          @geometry ||= begin
  25
+            file = data.respond_to?(:queued_for_write) ? data.queued_for_write[:original] : data.to_file
  26
+            ::Paperclip::Geometry.from_file(file)
  27
+          end
25 28
         end
26 29
                 
27 30
         protected
4  lib/generators/ckeditor/templates/active_record/carrierwave/migration.rb
@@ -10,8 +10,8 @@ def self.up
10 10
       t.string  :type, :limit => 30
11 11
 		  
12 12
       # Uncomment	it to save images dimensions, if your need it
13  
-#		  t.integer :width
14  
-#		  t.integer :height
  13
+		  t.integer :width
  14
+		  t.integer :height
15 15
 		  
16 16
       t.timestamps
17 17
     end
4  lib/generators/ckeditor/templates/active_record/dragonfly/migration.rb
@@ -11,8 +11,8 @@ def self.up
11 11
       t.string  :type, :limit => 30
12 12
 
13 13
       # Uncomment these to save image dimensions, if your need them.
14  
-      # t.integer :data_width
15  
-      # t.integer :data_height
  14
+      t.integer :data_width
  15
+      t.integer :data_height
16 16
 
17 17
       t.timestamps
18 18
     end
4  lib/generators/ckeditor/templates/active_record/paperclip/migration.rb
@@ -10,8 +10,8 @@ def self.up
10 10
       t.string  :type, :limit => 30
11 11
 		  
12 12
       # Uncomment	it to save images dimensions, if your need it
13  
-#		  t.integer :width
14  
-#		  t.integer :height
  13
+		  t.integer :width
  14
+		  t.integer :height
15 15
 		  
16 16
       t.timestamps
17 17
     end

0 notes on commit 4914510

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