attached 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/attached/attachment.rb +3 -2
- metadata +2 -2
data/lib/attached/attachment.rb
CHANGED
@@ -107,9 +107,10 @@ module Attached
|
|
107
107
|
# @object.avatar.assign(...)
|
108
108
|
|
109
109
|
def assign(file, identifier = Guid.new)
|
110
|
-
@file = file.tempfile
|
110
|
+
@file = file.respond_to?(:tempfile) ? file.tempfile : file
|
111
111
|
|
112
|
-
extension
|
112
|
+
extension ||= File.extname(file.original_filename) if file.respond_to?(:original_filename)
|
113
|
+
extension ||= File.extname(file.path)
|
113
114
|
|
114
115
|
instance_set :size, file.size
|
115
116
|
instance_set :extension, extension
|