attachable 0.0.4 → 0.0.5

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.
@@ -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
- self["#{attachment_file_prefix}_size"] = tempfile.size
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)
@@ -1,3 +1,3 @@
1
1
  module Attachable
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
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
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-02 00:00:00.000000000 -07:00
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: []