Sha256: c777fd89b1dea0477ff149a05883d0e918385f6513c5c1ddf07f7bae49348ba4
Contents?: true
Size: 623 Bytes
Versions: 16
Compression:
Stored size: 623 Bytes
Contents
require 'digest/sha2' class AddScaptimonyScapContentDigest < ActiveRecord::Migration def change unless column_exists?(:scaptimony_scap_contents, :digest) 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 end class ScapContentHack < ActiveRecord::Base self.table_name = 'scaptimony_scap_contents' def digest self[:digest] ||= Digest::SHA256.hexdigest scap_file.to_s end end end
Version data entries
16 entries across 16 versions & 1 rubygems