model_attachment 0.0.24 → 0.0.25

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.
@@ -221,7 +221,7 @@ module ModelAttachment
221
221
  def save_attributes
222
222
  return if file_name.nil? || file_name.class.to_s == "String"
223
223
  # ensure we save the tempfile before overwriting file_name
224
- @temp_file = self.file_name.tempfile
224
+ @temp_file = (self.file_name.respond_to?(:tempfile) ? self.file_name.tempfile : self.file_name)
225
225
 
226
226
  # get original filename info and clean up for storage
227
227
  filename = (self.file_name.respond_to?(:original_filename) ? File.basename(self.file_name.original_filename) : File.basename(self.file_name))
@@ -230,7 +230,7 @@ module ModelAttachment
230
230
 
231
231
  # save attributes
232
232
  self.content_type = self.file_name.content_type.strip
233
- self.file_size = self.file_name.tempfile.size.to_i
233
+ self.file_size = (self.file_name.respond_to?(:tempfile) ? self.file_name.tempfile.size.to_i : @temp_file.size.to_i)
234
234
  self.file_name = base + ext
235
235
  self.updated_at = Time.now
236
236
  end
@@ -1,3 +1,3 @@
1
1
  module ModelAttachment
2
- VERSION = "0.0.24"
2
+ VERSION = "0.0.25"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: model_attachment
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.24
5
+ version: 0.0.25
6
6
  platform: ruby
7
7
  authors:
8
8
  - Steve Walker
@@ -58,7 +58,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- hash: 3080609047319991630
61
+ hash: -4316983688232993659
62
62
  segments:
63
63
  - 0
64
64
  version: "0"