ripta-dm-paperclip 2.6.1 → 2.6.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,7 +43,7 @@ require 'dm-paperclip/attachment'
43
43
  # documentation for Paperclip::ClassMethods for more useful information.
44
44
  module Paperclip
45
45
 
46
- VERSION = "2.6.1"
46
+ VERSION = "2.6.2.1"
47
47
 
48
48
  # To configure Paperclip, put this code in an initializer, Rake task, or wherever:
49
49
  #
@@ -84,12 +84,20 @@ module Paperclip
84
84
  instance_write(:content_type, uploaded_file['content_type'] ? uploaded_file['content_type'].strip : uploaded_file['tempfile'].content_type.to_s.strip)
85
85
  instance_write(:file_size, uploaded_file['size'] ? uploaded_file['size'].to_i : uploaded_file['tempfile'].size.to_i)
86
86
  instance_write(:updated_at, Time.now)
87
- else
87
+ elsif uploaded_file.respond_to?(:to_tempfile)
88
88
  @queued_for_write[:original] = uploaded_file.to_tempfile
89
89
  instance_write(:file_name, uploaded_file.original_filename.strip.gsub(/[^\w\d\.\-]+/, '_'))
90
90
  instance_write(:content_type, uploaded_file.content_type.to_s.strip)
91
91
  instance_write(:file_size, uploaded_file.size.to_i)
92
92
  instance_write(:updated_at, Time.now)
93
+ elsif uploaded_file.respond_to?(:tempfile)
94
+ @queued_for_write[:original] = uploaded_file.tempfile
95
+ instance_write(:file_name, uploaded_file.original_filename.strip.gsub(/[^\w\d\.\-]+/, '_'))
96
+ instance_write(:content_type, uploaded_file.content_type.to_s.strip)
97
+ instance_write(:file_size, uploaded_file.size.to_i)
98
+ instance_write(:updated_at, Time.now)
99
+ else
100
+ raise ArgumentError, "The +uploaded_file+ (#{uploaded_file.class.name}) must respond to one of: [], to_tempfile, or tempfile"
93
101
  end
94
102
 
95
103
  @dirty = true
@@ -62,6 +62,7 @@ class PaperclipTest < Test::Unit::TestCase
62
62
  context "with a subclass" do
63
63
  setup do
64
64
  class ::SubDummy < Dummy; end
65
+ SubDummy.finalize
65
66
  end
66
67
 
67
68
  should "be able to use the attachment from the subclass" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ripta-dm-paperclip
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.6.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: