attachable 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/attachable.rb +8 -1
- data/lib/attachable/version.rb +1 -1
- metadata +3 -5
data/lib/attachable.rb
CHANGED
@@ -45,7 +45,14 @@ module Attachable
|
|
45
45
|
def file=(tempfile)
|
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
|
+
|
49
|
+
size = nil
|
50
|
+
if tempfile.respond_to?(:size)
|
51
|
+
size = tempfile.size
|
52
|
+
elsif tempfile.respond_to?(:stat)
|
53
|
+
size = tempfile.stat.size
|
54
|
+
end
|
55
|
+
self["#{attachment_file_prefix}_size"] = size unless size.nil?
|
49
56
|
|
50
57
|
filename = nil
|
51
58
|
if tempfile.respond_to?(:original_filename)
|
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.5
|
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-05-
|
12
|
+
date: 2012-05-03 00:00:00.000000000 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
description: Add methods to automatically manage a file as part of a Rails model
|
@@ -57,6 +57,4 @@ rubygems_version: 1.6.2
|
|
57
57
|
signing_key:
|
58
58
|
specification_version: 3
|
59
59
|
summary: A simple set of extensions to support files in a model
|
60
|
-
test_files:
|
61
|
-
- test/attachable_test.rb
|
62
|
-
- test/test_helper.rb
|
60
|
+
test_files: []
|