lib/attached/attachment.rb in attached-0.3.2 vs lib/attached/attachment.rb in attached-0.3.3
- old
+ new
@@ -71,13 +71,13 @@
options = self.class.options.merge(options)
@name = name
@instance = instance
- @queue = {}
- @purge = []
- @errors = []
+ @queue = {}
+ @purge = []
+ @errors = []
@path = options[:path]
@styles = options[:styles]
@default = options[:default]
@medium = options[:medium]
@@ -116,13 +116,10 @@
# Usage:
#
# @object.avatar.assign(...)
def assign(file, identifier = "#{Guid.new}")
-
- if file.is_a?(Attached::Attachment)
- file = file.file
- end
+ file = file.file if file.is_a?(Attached::Attachment)
@file = file.respond_to?(:tempfile) ? file.tempfile : file
extension ||= File.extname(file.original_filename) if file.respond_to?(:original_filename)
extension ||= File.extname(file.path) if file.respond_to?(:path)
\ No newline at end of file