Module: Her::Model::ORM::DestroyMethods::ClassMethods

Defined in:
lib/her/model/orm/destroy_methods.rb

Instance Method Summary collapse

Instance Method Details

#delete(ids) ⇒ Object



46
47
48
# File 'lib/her/model/orm/destroy_methods.rb', line 46

def delete(ids)
  Array(ids).map{ |id| new(id: id).delete }.count
end

#destroy(ids) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/her/model/orm/destroy_methods.rb', line 38

def destroy(ids)
  is_array = ids.is_a?(Array)
  ids = Array(ids)
  collection = ids.map{ |id| new(id: id).destroy }
  collection = collection.first unless is_array
  collection
end