module ActiveRecord::Persistence

Public Instance Methods

destroy_row() click to toggle source

Maybe override Rails' destroy_row for soft-delete functionality

# File lib/zombie_record.rb, line 14
def destroy_row
  if self.class.include?(ZombieRecord::Restorable)
    time = current_time_from_proper_timezone

    update_params = { deleted_at: time }
    if self.class.column_names.include?("updated_at")
      update_params[:updated_at] = time
    end

    update_columns(update_params) ? 1 : 0
  else
    zombie_record_alias_destroy_row
  end
end
zombie_record_alias_destroy_row()
Alias for: destroy_row