rails / 7.0.0 / activerecord / encryption / configurable.html /

module ActiveRecord::Encryption::Configurable

Configuration API for ActiveRecord::Encryption

Public Instance Methods

on_encrypted_attribute_declared (&block) Show source
# File activerecord/lib/active_record/encryption/configurable.rb, line 42
def on_encrypted_attribute_declared(&block)
  self.encrypted_attribute_declaration_listeners ||= Concurrent::Array.new
  self.encrypted_attribute_declaration_listeners << block
end

Register callback to be invoked when an encrypted attribute is declared.

Example:

ActiveRecord::Encryption.on_encrypted_attribute_declared do |klass, attribute_name|
  ...
end

© 2004–2021 David Heinemeier Hansson
Licensed under the MIT License.