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