Sha256: 9341ca14f1c3b906ce20a33a0742e6e2f38bfb21bc6f97ea6f244594cf0a073f
Contents?: true
Size: 541 Bytes
Versions: 2
Compression:
Stored size: 541 Bytes
Contents
require 'digest/sha2' class AddScaptimonyScapContentDigest < ActiveRecord::Migration def change add_column :scaptimony_scap_contents, :digest, :string, :limit => 128 ScapContentHack.find_each do |content| content.digest content.save! end change_column :scaptimony_scap_contents, :digest, :string, :null => false end class ScapContentHack < ActiveRecord::Base self.table_name = 'scaptimony_scap_contents' def digest self[:digest] ||= Digest::SHA256.hexdigest "#{scap_file}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
scaptimony-0.3.1 | db/migrate/20150115155947_add_scaptimony_scap_content_digest.rb |
scaptimony-0.3.0 | db/migrate/20150115155947_add_scaptimony_scap_content_digest.rb |