module AttrKeyring::ActiveRecord
Public Class Methods
included(target)
click to toggle source
# File lib/attr_keyring/active_record.rb, line 7 def self.included(target) AttrKeyring.setup(target) target.class_eval do before_save :migrate_to_latest_encryption_key def keyring_rotate! migrate_to_latest_encryption_key save! end end target.prepend( Module.new do def reload(options = nil) instance = super self.class.encrypted_attributes.each do |attribute| clear_decrypted_column_cache(attribute) end instance end end ) end
Public Instance Methods
keyring_rotate!()
click to toggle source
# File lib/attr_keyring/active_record.rb, line 13 def keyring_rotate! migrate_to_latest_encryption_key save! end
reload(options = nil)
click to toggle source
Calls superclass method
# File lib/attr_keyring/active_record.rb, line 21 def reload(options = nil) instance = super self.class.encrypted_attributes.each do |attribute| clear_decrypted_column_cache(attribute) end instance end