Permalink
Browse files

Fix paperclip tempfile detect

  • Loading branch information...
1 parent a2c3de0 commit 4914510687e90a49ec44cd41cc3a3feb9711d2e5 @galetahub committed May 14, 2012
@@ -21,7 +21,10 @@ def self.extended(base)
module InstanceMethods
def geometry
- @geometry ||= ::Paperclip::Geometry.from_file(data.to_file)
+ @geometry ||= begin
+ file = data.respond_to?(:queued_for_write) ? data.queued_for_write[:original] : data.to_file
+ ::Paperclip::Geometry.from_file(file)
+ end
end
protected
@@ -10,8 +10,8 @@ def self.up
t.string :type, :limit => 30
# Uncomment it to save images dimensions, if your need it
-# t.integer :width
-# t.integer :height
+ t.integer :width
+ t.integer :height
t.timestamps
end
@@ -11,8 +11,8 @@ def self.up
t.string :type, :limit => 30
# Uncomment these to save image dimensions, if your need them.
- # t.integer :data_width
- # t.integer :data_height
+ t.integer :data_width
+ t.integer :data_height
t.timestamps
end
@@ -10,8 +10,8 @@ def self.up
t.string :type, :limit => 30
# Uncomment it to save images dimensions, if your need it
-# t.integer :width
-# t.integer :height
+ t.integer :width
+ t.integer :height
t.timestamps
end

0 comments on commit 4914510

Please sign in to comment.