Module: DeletedAt::ActiveRecord::ClassMethods

Defined in:
lib/deleted_at/active_record.rb

Instance Method Summary collapse

Instance Method Details

#allObject



20
21
22
# File 'lib/deleted_at/active_record.rb', line 20

def all
  const_get(:Present)
end

#const_missing(const) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/deleted_at/active_record.rb', line 24

def const_missing(const)
  case const
  when :All, :Deleted, :Present
    all_without_deleted_at.tap do |rel|
      rel.deleted_at_scope = const
    end
  else super
  end
end

#inherited(subclass) ⇒ Object



15
16
17
18
# File 'lib/deleted_at/active_record.rb', line 15

def inherited(subclass)
  super
  subclass.with_deleted_at self.deleted_at
end