dm-paperclip-r3 2.4.3 → 2.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dm-paperclip-r3.rb +1 -1
- data/lib/dm-paperclip-r3/attachment.rb +15 -5
- metadata +3 -3
data/lib/dm-paperclip-r3.rb
CHANGED
@@ -44,7 +44,7 @@ require 'dm-paperclip-r3/attachment'
|
|
44
44
|
# documentation for Paperclip::ClassMethods for more useful information.
|
45
45
|
module Paperclip
|
46
46
|
|
47
|
-
VERSION = "2.4.
|
47
|
+
VERSION = "2.4.4"
|
48
48
|
|
49
49
|
# To configure Paperclip, put this code in an initializer, Rake task, or wherever:
|
50
50
|
#
|
@@ -77,11 +77,21 @@ module Paperclip
|
|
77
77
|
|
78
78
|
return nil if uploaded_file.nil?
|
79
79
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
80
|
+
if uploaded_file.respond_to?(:[])
|
81
|
+
uploaded_file = uploaded_file.to_mash
|
82
|
+
|
83
|
+
@queued_for_write[:original] = to_tempfile(uploaded_file)
|
84
|
+
instance_write(:file_name, uploaded_file['filename'].strip.gsub(/[^\w\d\.\-]+/, '_'))
|
85
|
+
instance_write(:content_type, uploaded_file['content_type'] ? uploaded_file['content_type'].strip : uploaded_file['tempfile'].content_type.to_s.strip)
|
86
|
+
instance_write(:file_size, uploaded_file['size'] ? uploaded_file['size'].to_i : uploaded_file['tempfile'].size.to_i)
|
87
|
+
instance_write(:updated_at, Time.now)
|
88
|
+
else
|
89
|
+
@queued_for_write[:original] = to_tempfile(uploaded_file)
|
90
|
+
instance_write(:file_name, uploaded_file.original_filename.strip.gsub(/[^\w\d\.\-]+/, '_'))
|
91
|
+
instance_write(:content_type, uploaded_file.content_type.to_s.strip)
|
92
|
+
instance_write(:file_size, uploaded_file.size.to_i)
|
93
|
+
instance_write(:updated_at, Time.now)
|
94
|
+
end
|
85
95
|
|
86
96
|
@dirty = true
|
87
97
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-paperclip-r3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 2.4.
|
9
|
+
- 4
|
10
|
+
version: 2.4.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joel Reed
|