Module: Abbish::Sequel::Plugins::Model::RecordProtection

Defined in:
lib/model/record_protection.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.configure(model, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/model/record_protection.rb', line 9

def self.configure(model, options = {})
  options = {
      :enabled => true,
      :column_protected => :record_protected,
      :raise_protected_message => 'Cannot destroy protected record',
  }.merge(options)

  model.instance_eval do
    self.record_protection_options = options
  end
end