Skip to content

Commit

Permalink
fix: prevent duplicate service_area crashing placeca when creating a …
Browse files Browse the repository at this point in the history
…new partner
  • Loading branch information
aaaaargZombies committed Sep 19, 2023
1 parent ec3118c commit 6709213
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/controllers/admin/partners_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ def create

authorize @partner

# prevent someone trying to add the same service_area twice by mistake and causing a crash
@partner.service_areas = @partner.service_areas.uniq { |service_area| service_area.neighbourhood_id }

respond_to do |format|
if @partner.save
format.html do
Expand Down

0 comments on commit 6709213

Please sign in to comment.