Sha256: 9fd4472b7b8711c20e5d930d93c77bdfecfc74823336c01b3f6c8e498fee6c3c
Contents?: true
Size: 793 Bytes
Versions: 17
Compression:
Stored size: 793 Bytes
Contents
module CompositePrimaryKeys module CompositeRelation include CompositePrimaryKeys::ActiveRecord::Batches include CompositePrimaryKeys::ActiveRecord::Calculations include CompositePrimaryKeys::ActiveRecord::FinderMethods include CompositePrimaryKeys::ActiveRecord::QueryMethods def destroy(id_or_array) # Without CPK: #if id.is_a?(Array) # id.map { |one_id| destroy(one_id) } #else # find(id).destroy #end id_or_array = if id_or_array.kind_of?(CompositePrimaryKeys::CompositeKeys) [id_or_array] else Array(id_or_array) end id_or_array.each do |id| where(cpk_id_predicate(table, self.primary_key, id)).each do |record| record.destroy end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems