Check argument in File#file=

This commit is contained in:
Thibault Jouan 2015-05-06 06:26:11 +00:00
parent 4e66dc4522
commit 1d0071c4aa

View File

@ -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