From ebc41a9b772047713aa05457b0d0c750db26fc27 Mon Sep 17 00:00:00 2001 From: fauno Date: Sat, 20 Apr 2019 12:49:31 -0300 Subject: [PATCH] mostrar los errores por campo --- app/controllers/consensos_controller.rb | 2 +- app/controllers/piratas_controller.rb | 2 +- app/controllers/posiciones_controller.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/consensos_controller.rb b/app/controllers/consensos_controller.rb index c0c3f2a..e3a64cd 100644 --- a/app/controllers/consensos_controller.rb +++ b/app/controllers/consensos_controller.rb @@ -46,7 +46,7 @@ class ConsensosController < ApplicationController if @consenso.save render status: :created else - render json: { errors: @consenso.errors.full_messages }, + render json: { errors: @consenso.errors.messages }, status: :unprocessable_entity end end diff --git a/app/controllers/piratas_controller.rb b/app/controllers/piratas_controller.rb index ee699be..ea6090d 100644 --- a/app/controllers/piratas_controller.rb +++ b/app/controllers/piratas_controller.rb @@ -16,7 +16,7 @@ class PiratasController < ApplicationController return if @pirata.save - render json: { errors: @pirata.errors.full_messages }, + render json: { errors: @pirata.errors.messages }, status: :unprocessable_entity end end diff --git a/app/controllers/posiciones_controller.rb b/app/controllers/posiciones_controller.rb index 900c134..bf5a94d 100644 --- a/app/controllers/posiciones_controller.rb +++ b/app/controllers/posiciones_controller.rb @@ -24,7 +24,7 @@ class PosicionesController < ApplicationController if @posicion.try(:save) render status: :created else - render json: @posicion.try(:errors).try(:full_messages), + render json: @posicion.try(:errors).try(:messages), status: :unprocessable_entity end end