From 01700017e9c3d333e2ca80ead24c514a2dd19d79 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 12 Mar 2022 19:01:12 -0300 Subject: [PATCH] indicar a la raspberry que el registro es duplicado --- app/controllers/readings_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/readings_controller.rb b/app/controllers/readings_controller.rb index 0752949..a9aa8be 100644 --- a/app/controllers/readings_controller.rb +++ b/app/controllers/readings_controller.rb @@ -14,7 +14,6 @@ class ReadingsController < ActionController::API Reading.transaction do reading = raspberry.readings.build reading_params reading.id = params[:transaction_uuid] - # TODO: Verificar firma reading.signature = request.headers[:'X-Signature'] params[:arduinos]&.each do |a| @@ -31,6 +30,8 @@ class ReadingsController < ActionController::API head :bad_request end end + rescue ActiveRecord::RecordNotUnique + render plain: params[:transaction_uuid], status: :ok end private