Module: Unsakini::EncryptableModelConcern::ClassMethods

Defined in:
app/models/concerns/unsakini/encryptable_model_concern.rb

Instance Method Summary collapse

Instance Method Details

#encryptable_attributes(*attrs) ⇒ Object

Sets the ‘encryptable_attributes` class instance variable in the model.

Encryptable attributes are encrypted before saving using ‘before_save` hook and decrypted using `after_save` and `after_find` hooks.

Example: “‘

class Board < BaseModel
  encryptable_attributes :name, :title, :content
end

“‘

Parameters:

  • attrs (Symbol)

    model attributes



28
29
30
# File 'app/models/concerns/unsakini/encryptable_model_concern.rb', line 28

def encryptable_attributes(*attrs)
  @encryptable_attributes = attrs
end