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

Public Instance Methods

before_destroy() click to toggle source
Calls superclass method
# File lib/model/super_record/protection.rb, line 49
def before_destroy
  super
  raise ProtectedError, self.class.record_protection_options[:raise_protected_message] if record_protected?
end
record_protected?() click to toggle source
# File lib/model/super_record/protection.rb, line 34
def record_protected?
  self.class.record_protection_options[:enabled] ? send("#{self.class.record_protection_options[:feature_column_protected]}") == 1 : false
end
set_record_protected() click to toggle source
# File lib/model/super_record/protection.rb, line 38
def set_record_protected
  send("#{self.class.record_protection_options[:feature_column_protected]}=", 1) if self.class.record_protection_options[:enabled]
end
set_record_protected!() click to toggle source
# File lib/model/super_record/protection.rb, line 42
def set_record_protected!
  if self.class.record_protection_options[:enabled]
    set_record_protected
    self.save
  end
end