diff --git a/app/controllers/affinities_controller.rb b/app/controllers/affinities_controller.rb index 7d63e9e..1412423 100644 --- a/app/controllers/affinities_controller.rb +++ b/app/controllers/affinities_controller.rb @@ -26,7 +26,7 @@ class AffinitiesController < ApplicationController } end - GroupAffinity.upsert_all(affinities) + GroupAffinity.upsert_all(affinities, unique_by: :uindex_group_pair) render json: {}, status: :ok rescue ActiveRecord::InvalidForeignKey @@ -50,7 +50,7 @@ class AffinitiesController < ApplicationController } end - GroupAffinity.upsert_all(affinities) + GroupAffinity.upsert_all(affinities, unique_by: :uindex_group_pair) render json: {}, status: :ok end