Module: Trashy::ClassMethods
- Defined in:
- lib/trashy.rb
Instance Method Summary collapse
-
#trashed ⇒ Object
Trashed returns the soft-deleted records for this model.
-
#untrashed ⇒ Object
Untrashed returns all the records for this model that haven’t been soft-deleted.
Instance Method Details
#trashed ⇒ Object
Trashed returns the soft-deleted records for this model.
42 43 44 45 46 47 |
# File 'lib/trashy.rb', line 42 def trashed @has_trashy_column ||= column_names.include?(trashy_column.to_s) return none unless @has_trashy_column unscoped.where.not(trashy_column.to_s => (false if trashy_boolean)) end |
#untrashed ⇒ Object
Untrashed returns all the records for this model that haven’t been soft-deleted.
34 35 36 37 38 39 |
# File 'lib/trashy.rb', line 34 def untrashed @has_trashy_column ||= column_names.include?(trashy_column.to_s) return all unless @has_trashy_column where(trashy_column.to_s => (false if trashy_boolean)) end |