Module: DeletedAt::Core::ClassMethods

Defined in:
lib/deleted_at/core.rb

Instance Method Summary collapse

Instance Method Details

#deleted_at_attributesObject



40
41
42
43
44
# File 'lib/deleted_at/core.rb', line 40

def deleted_at_attributes
  attributes = {
    deleted_at[:column] => deleted_at[:proc].call
  }
end

#with_deleted_at(options = {}, &block) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/deleted_at/core.rb', line 28

def with_deleted_at(options={}, &block)
  self.deleted_at = DeletedAt::DEFAULT_OPTIONS.merge(options)
  self.deleted_at[:proc] = block if block_given?

  return if ::DeletedAt.disabled?

  DeletedAt::Core.raise_missing(self) unless Core.has_deleted_at_column?(self)

  self.prepend(DeletedAt::ActiveRecord)

end