跳至内容 跳至搜索

ActiveRecord::Encryption 的配置 API

方法
O

实例公共方法

on_encrypted_attribute_declared(&block)

注册在声明加密属性时要调用的回调函数。

示例

ActiveRecord::Encryption.on_encrypted_attribute_declared do |klass, attribute_name|
  ...
end
# File activerecord/lib/active_record/encryption/configurable.rb, line 47
def on_encrypted_attribute_declared(&block)
  self.encrypted_attribute_declaration_listeners ||= Concurrent::Array.new
  self.encrypted_attribute_declaration_listeners << block
end