Module: Anony::Config

Defined in:
lib/anony/config.rb

Overview

Configuration which modifies how the gem will behave in your application. It’s recommended practice to configure this in an initializer.

Examples:

# config/initializers/anony.rb
require "anony"

Anony::Config.ignore_fields(:id)

Class Method Summary collapse

Class Method Details

.ignore_fields(*fields) ⇒ Object

A list of database or model properties to be ignored when anonymising. This is helpful in Rails applications when there are common columns such as ‘id`, `created_at` and `updated_at`, which we would never want to try and anonymise.

By default, this is an empty collection (i.e. no fields are ignored).

Examples:

Ignoring common Rails fields

Anony::Config.ignore_fields(:id, :created_at, :updated_at)

Parameters:

  • fields (Array<Symbol>)

    A list of fields names to ignore.



36
37
38
# File 'lib/anony/config.rb', line 36

def self.ignore_fields(*fields)
  self.ignores = Array(fields)
end