mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
Story#119627029 - save checksum of legal doc to DB
(cherry picked from commit dd3f19c
)
This commit is contained in:
parent
5ed949efc6
commit
cd81a3d356
1 changed files with 2 additions and 1 deletions
|
@ -33,6 +33,7 @@ class LegalDocument < ActiveRecord::Base
|
|||
|
||||
def save_to_filesystem
|
||||
binary = Base64.decode64(body)
|
||||
digest = Digest::SHA1.new.update(binary).to_s
|
||||
|
||||
loop do
|
||||
rand = SecureRandom.random_number.to_s.last(4)
|
||||
|
@ -45,7 +46,7 @@ class LegalDocument < ActiveRecord::Base
|
|||
|
||||
File.open(path, 'wb') { |f| f.write(binary) } unless Rails.env.test?
|
||||
self.path = path
|
||||
|
||||
self.checksum = digest
|
||||
end
|
||||
|
||||
def calc_checksum
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue