attachable 0.0.2 → 0.0.3
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.
- data/lib/attachable.rb +11 -2
- data/lib/attachable/version.rb +1 -1
- metadata +2 -2
data/lib/attachable.rb
CHANGED
@@ -46,8 +46,17 @@ module Attachable
|
|
46
46
|
tempfile.rewind #This may not be super efficient, but it's the necessary fix for Rails 3.1
|
47
47
|
self["#{attachment_file_prefix}_data"] = tempfile.read
|
48
48
|
self["#{attachment_file_prefix}_size"] = tempfile.size
|
49
|
-
|
50
|
-
|
49
|
+
|
50
|
+
filename = nil
|
51
|
+
print "hi"
|
52
|
+
if tempfile.respond_to?(:original_filename)
|
53
|
+
filename = tempfile.original_filename
|
54
|
+
elsif tempfile.respond_to?(:path)
|
55
|
+
filename = File.basename(tempfile.path)
|
56
|
+
end
|
57
|
+
self["#{attachment_file_prefix}_name"] = filename unless filename.nil?
|
58
|
+
|
59
|
+
self["#{attachment_file_prefix}_type"] = tempfile.content_type if tempfile.respond_to?(:content_type)
|
51
60
|
end
|
52
61
|
end
|
53
62
|
|
data/lib/attachable/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attachable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-02 00:00:00.000000000 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
description: Add methods to automatically manage a file as part of a Rails model
|