diff options
author | HombreLaser <sebastian-440@live.com> | 2023-04-04 17:37:23 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2023-04-04 17:37:23 -0600 |
commit | 3afd35371caa0677fd2f66491bd337d1673013dc (patch) | |
tree | ee915480908dc2a5cac01f4b7b6ad554d78370e9 /app/controllers | |
parent | a7f095d7171fe496c8037a451aaecfd234c30a01 (diff) |
Añadido validador de reseña única
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/api/reviews_controller.rb | 4 |
1 files changed, 2 insertions, 2 deletions
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 |