about summary refs log tree commit diff
path: root/app/controllers/api/base_controller.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-12-08 21:27:36 +0100
committerGitHub <noreply@github.com>2019-12-08 21:27:36 +0100
commit246addd5b33a172600342af3fb6fb5e4c80ad95e (patch)
tree98b87efd3f5f3d41d75482707924fde708c074ec /app/controllers/api/base_controller.rb
parent7d59e25fbd7a0209c11cbe6aac4400bbca4de82b (diff)
parent49027ee948bc76cc89214f8f340d353763796f1d (diff)
Merge pull request #1251 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/controllers/api/base_controller.rb')
-rw-r--r--app/controllers/api/base_controller.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb
index 33df75b37..144fdd6ac 100644
--- a/app/controllers/api/base_controller.rb
+++ b/app/controllers/api/base_controller.rb
@@ -20,6 +20,10 @@ class Api::BaseController < ApplicationController
     render json: { error: e.to_s }, status: 422
   end
 
+  rescue_from ActiveRecord::RecordNotUnique do
+    render json: { error: 'Duplicate record' }, status: 422
+  end
+
   rescue_from ActiveRecord::RecordNotFound do
     render json: { error: 'Record not found' }, status: 404
   end