Module: Glib::SoftDeletable::ClassMethods

Defined in:
app/models/concerns/glib/soft_deletable.rb

Instance Method Summary collapse

Instance Method Details

#__mark_for_destruction_behaviourObject



23
24
25
# File 'app/models/concerns/glib/soft_deletable.rb', line 23

def __mark_for_destruction_behaviour
  @__glib_mark_for_destruction_behaviour ||= :disallowed
end

#auto_hide_soft_deleted_recordsObject



9
10
11
12
13
14
15
16
# File 'app/models/concerns/glib/soft_deletable.rb', line 9

def auto_hide_soft_deleted_records
  column_name = :deleted_at
  default_scope { where(column_name => nil) }

  if Rails.env.development? || Rails.env.test?
    raise ActiveRecord::ConfigurationError, "#{table_name}.#{column_name} need to be indexed" unless connection.index_exists?(table_name, column_name)
  end
end

#on_mark_for_destruction(behaviour) ⇒ Object

‘behaviour` can be either `:soft_destroy` or `:hard_destroy“



19
20
21
# File 'app/models/concerns/glib/soft_deletable.rb', line 19

def on_mark_for_destruction(behaviour)
  @__glib_mark_for_destruction_behaviour = behaviour
end