Module: Hub::SoftDelete

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

Instance Method Summary collapse

Instance Method Details

#deleted?Boolean

Returns:

  • (Boolean)


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

def deleted?
  deleted_at.present?
end

#destroyObject



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

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