app/models/apidae/selection.rb in apidae-0.4.4 vs app/models/apidae/selection.rb in apidae-0.4.5
- old
+ new
@@ -26,10 +26,11 @@
added.each do |o|
obj = Apidae::Object.find_by_apidae_id(o)
Apidae::SelectionObject.create(apidae_selection_id: apidae_sel.id, apidae_object_id: obj.id)
end
- Apidae::SelectionObject.where(apidae_selection_id: apidae_sel.id, apidae_object_id: removed).delete_all
+ removed_ids = Apidae::Object.where(apidae_id: removed).map {|o| o.id}
+ Apidae::SelectionObject.where(apidae_selection_id: apidae_sel.id, apidae_object_id: removed_ids).delete_all
end
def results(where_clause, offset, size)
objects.includes(:town).limit(size).offset(offset).where(where_clause)
end