Check argument in File#file=
This commit is contained in:
1 parent
4e66dc4522
commit
1d0071c4aa
1 file changed
+1
@@ -9,6 +9,7 @@ class Sound < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def file= file
|
||||
self.errors[:sha256] << 'No file given' and return unless file
|
||||
self.sha256 = Digest::SHA256.file(file.path).hexdigest
|
||||
FileUtils.cp file.path, path
|
||||
self.mime_type = file.content_type
|
||||
|
||||
Reference in new issue
Block a user