module Sequel::Plugins::ColumnEncryption::InstanceMethods

  1. lib/sequel/plugins/column_encryption.rb


Public Instance

  1. reencrypt

Public Instance methods


Reencrypt the model if needed. Looks at all of the models encrypted columns and if any were encypted with older keys or a different format, reencrypt with the current key and format and save the object. Returns the object if reencryption was needed, or nil if reencryption was not needed.

[show source]
    # File lib/sequel/plugins/column_encryption.rb
687 def reencrypt
688   do_save = false
690   model.send(:column_encryption_metadata).each do |column, metadata|
691     if (value = values[column]) && !value.start_with?(
692       do_save = true
693       values[column] =
694     end
695   end
697   save if do_save
698 end