module Abbish::Sequel::Plugins::Model::SuperRecord::Protection

Constants

ProtectedError

Public Class Methods

configure(model, options = {}) click to toggle source
# File lib/model/super_record/protection.rb, line 8
def self.configure(model, options = {})
  options = {
      :enabled => true,
      :feature_column_protected => :record_protected,
      :raise_protected_message => 'Cannot destroy protected record',
  }.merge(options)

  Abbish::Sequel::Plugins::Model::SuperRecord.check_feature_column model, options[:feature_column_protected]

  model.instance_eval do
    self.record_protection_options = options
  end
end