Sha256: 02b14f7b183eb23aef2ae01ffefd49d4995698914ffba202ce8b963e7c2b66ea
Contents?: true
Size: 750 Bytes
Versions: 45
Compression:
Stored size: 750 Bytes
Contents
module Abstractor module Methods module Models module SoftDelete def self.included(base) attr_accessor :soft_delete base.send(:scope, :not_deleted, -> { base.where(:deleted_at => nil) }) end def process_soft_delete self.deleted_at = Time.zone.now end def soft_delete=(removed) if (removed.is_a?(TrueClass) || removed.to_s == 't' || removed.to_s == '1') process_soft_delete end end def soft_delete !self.deleted_at.blank? end def soft_delete! process_soft_delete save! end def deleted? !deleted_at.blank? end end end end end
Version data entries
45 entries across 45 versions & 1 rubygems