From 3afd35371caa0677fd2f66491bd337d1673013dc Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Tue, 4 Apr 2023 17:37:23 -0600 Subject: Añadido validador de reseña única MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/reviews_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/api/reviews_controller.rb b/app/controllers/api/reviews_controller.rb index 951e19d..1f48362 100644 --- a/app/controllers/api/reviews_controller.rb +++ b/app/controllers/api/reviews_controller.rb @@ -26,7 +26,7 @@ module Api if @review.save render json: serialized_object.serializable_hash, status: :ok else - render json: { error_messages: @review.errors.full_messages }, status: :unprocessable_entity + render json: { errors: @review.errors.as_json }, status: :unprocessable_entity end end @@ -48,7 +48,7 @@ module Api @serialized_object ||= ProductReviewSerializer.new( ProductReview.joins(:user_account).select('product_reviews.*', 'user_accounts.first_name as author_name') - .find(@review.id) + .find(@review.id) ) end end -- cgit v1.2.3