Sha256: 42d6b4fcc75ed6dbcc2e8ff94d1d3f9fe23f2389a1ea0f2d7d413ed1cff4ec44
Contents?: true
Size: 851 Bytes
Versions: 18
Compression:
Stored size: 851 Bytes
Contents
module SoftDeletion module Setup def self.included(base) base.extend ClassMethods end module ClassMethods # When you call this, it will include the core module and its methods # # Options: # # *default_scope*, value: true/false # If true, it will also define a default scope # # It will check if the column "deleted_at" exist before applying default scope def has_soft_deletion(options={}) include SoftDeletion::Core if options[:default_scope] self.soft_delete_default_scope = name default_scope do if Thread.current[:"soft_deletion_with_deleted_#{soft_delete_default_scope}"] where(nil) else where(deleted_at: nil) end end end end end end end
Version data entries
18 entries across 18 versions & 1 rubygems