mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 00:12:03 +02:00
Don't create new legaldoc if it's already persistent
This commit is contained in:
parent
eb09447ee1
commit
58443f23aa
2 changed files with 4 additions and 14 deletions
|
@ -28,18 +28,9 @@ class LegalDocument < ApplicationRecord
|
|||
end
|
||||
|
||||
def val_body_length
|
||||
if body.start_with? ENV['legal_documents_dir']
|
||||
if File.exist? body
|
||||
self.path = body
|
||||
self.body = nil
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
errors.add(:body, :length) if body.nil? || body.size < MIN_BODY_SIZE
|
||||
end
|
||||
|
||||
|
||||
def save_to_filesystem
|
||||
binary = Base64.decode64(body)
|
||||
digest = Digest::SHA1.new.update(binary).to_s
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue