lib/anony/anonymisable.rb
# Run all anonymisation strategies on the model instance before saving it.
#
# @return [Anony::Result] described if the save was successful, and the fields or errors created
# @example
#   manager = Manager.first
#   manager.anonymise!
Run all anonymisation strategies on the model instance before saving it.
Run all anonymisation strategies on the model instance before saving it .
def anonymise!
      unless self.class.anonymise_config
        raise ArgumentError, "#{self.class.name} does not have an Anony configuration"
      end
      self.class.anonymise_config.validate!
      self.class.anonymise_config.apply(self)
    rescue ActiveRecord::RecordNotSaved, ActiveRecord::RecordNotDestroyed => e
      Result.failed(e)
    end
def anonymise! unless self . class . anonymise_config raise ArgumentError , "#{self.class.name} does not have an Anony configuration" end self . class . anonymise_config . validate! self . class . anonymise_config . apply ( self ) rescue ActiveRecord :: RecordNotSaved , ActiveRecord :: RecordNotDestroyed => e Result . failed ( e ) end
Run all anonymisation strategies on the model instance before saving it.
Run all anonymisation strategies on the model instance before saving it .
described if the save was successful, and the fields or errors created
described if the save was successful and the fields or errors created
Anony::Result
example
manager = Manager.first manager.anonymise!
manager = Manager . first manager . anonymise!