lib/crypt_keeper/model.rb
# Public: Encrypt a table for the first time.
Encrypt a table for the first time.
Encrypt a table for the first time .
def encrypt_table!
        enc       = encryptor_klass.new(crypt_keeper_options)
        tmp_table = Class.new(ActiveRecord::Base).tap { |c| c.table_name = self.table_name }
        transaction do
          tmp_table.find_each do |r|
            crypt_keeper_fields.each do |field|
              r.send("#{field}=", enc.encrypt(r[field])) if r[field].present?
            end
            r.save!
          end
        end
      end
def encrypt_table! enc = encryptor_klass . new ( crypt_keeper_options ) tmp_table = Class . new ( ActiveRecord :: Base ) . tap { | c | c . table_name = self . table_name } transaction do tmp_table . find_each do | r | crypt_keeper_fields . each do | field | r . send ( "#{field}=" , enc . encrypt ( r [ field ] ) ) if r [ field ] . present? end r . save! end end end
Public: Encrypt a table for the first time.
Public : Encrypt a table for the first time .