Module: SoftDelete

Extended by:
ActiveSupport::Concern
Included in:
Reply, Site, Topic
Defined in:
app/models/concerns/soft_delete.rb

Instance Method Summary collapse

Instance Method Details

#deleted?Boolean


22
23
24
# File 'app/models/concerns/soft_delete.rb', line 22

def deleted?
  deleted_at.present?
end

#destroyObject


10
11
12
13
14
15
16
17
18
19
20
# File 'app/models/concerns/soft_delete.rb', line 10

def destroy
  run_callbacks(:destroy) do
    if persisted?
      t = Time.now.utc
      update_columns(deleted_at: t, updated_at: t)
    end

    @destroyed = true
  end
  freeze
end