Skip to content

Commit 309f2a7

Browse files
authored
Merge branch 'nz-justice-development' into master
2 parents 88d335e + 8e49490 commit 309f2a7

File tree

61 files changed

+1087
-1459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1087
-1459
lines changed

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ gem "rack-cors", require: "rack/cors"
2323
gem "rails", "~> 6.0"
2424
gem "sass-rails", "~> 6.0"
2525
gem "secure_headers", ">= 3.0"
26+
gem "with_advisory_lock"
2627

2728
group :production, :staging do
2829
gem "net-pop"

Gemfile.lock

+4
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,9 @@ GEM
446446
websocket-driver (0.7.6)
447447
websocket-extensions (>= 0.1.0)
448448
websocket-extensions (0.1.5)
449+
with_advisory_lock (5.1.0)
450+
activerecord (>= 6.1)
451+
zeitwerk (>= 2.6)
449452
xpath (3.2.0)
450453
nokogiri (~> 1.8)
451454
zeitwerk (2.7.1)
@@ -502,6 +505,7 @@ DEPENDENCIES
502505
standard
503506
timecop
504507
web-console (~> 4.1)
508+
with_advisory_lock
505509

506510
RUBY VERSION
507511
ruby 3.3.1p55

app/controllers/measure_categories_controller.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def create
2020
@measure_category.assign_attributes(permitted_attributes(@measure_category))
2121
authorize @measure_category
2222

23-
if @measure_category.save
23+
if @measure_category.save_with_cleanup
2424
render json: serialize(@measure_category), status: :created, location: @measure_category
2525
else
2626
render json: @measure_category.errors, status: :unprocessable_entity
@@ -46,6 +46,9 @@ def destroy
4646
def set_and_authorize_measure_category
4747
@measure_category = policy_scope(base_object).find(params[:id])
4848
authorize @measure_category
49+
rescue ActiveRecord::RecordNotFound
50+
raise unless action_name == "destroy"
51+
head :no_content
4952
end
5053

5154
def base_object

app/controllers/recommendation_categories_controller.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def create
2020
@recommendation_category.assign_attributes(permitted_attributes(@recommendation_category))
2121
authorize @recommendation_category
2222

23-
if @recommendation_category.save
23+
if @recommendation_category.save_with_cleanup
2424
render json: serialize(@recommendation_category), status: :created, location: @recommendation_category
2525
else
2626
render json: @recommendation_category.errors, status: :unprocessable_entity
@@ -45,6 +45,9 @@ def destroy
4545
def set_and_authorize_recommendation_category
4646
@recommendation_category = policy_scope(base_object).find(params[:id])
4747
authorize @recommendation_category
48+
rescue ActiveRecord::RecordNotFound
49+
raise unless action_name == "destroy"
50+
head :no_content
4851
end
4952

5053
def base_object

app/controllers/sdgtarget_categories_controller.rb

-55
This file was deleted.

app/controllers/sdgtarget_indicators_controller.rb

-55
This file was deleted.

app/controllers/sdgtarget_measures_controller.rb

-55
This file was deleted.

app/controllers/sdgtarget_recommendations_controller.rb

-55
This file was deleted.

app/controllers/sdgtargets_controller.rb

-71
This file was deleted.

app/controllers/user_categories_controller.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def create
2020
@user_category.assign_attributes(permitted_attributes(@user_category))
2121
authorize @user_category
2222

23-
if @user_category.save
23+
if @user_category.save_with_cleanup
2424
render json: serialize(@user_category), status: :created, location: @user_category
2525
else
2626
render json: @user_category.errors, status: :unprocessable_entity
@@ -45,6 +45,9 @@ def destroy
4545
def set_and_authorize_user_category
4646
@user_category = policy_scope(base_object).find(params[:id])
4747
authorize @user_category
48+
rescue ActiveRecord::RecordNotFound
49+
raise unless action_name == "destroy"
50+
head :no_content
4851
end
4952

5053
def base_object

0 commit comments

Comments
 (0)