summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2023-05-21 10:00:50 -0600
committerHombreLaser <sebastian-440@live.com>2023-05-21 10:00:50 -0600
commit332feb3066c7e0fd497311424ffe12c557f49fdd (patch)
treee3d08885e62331120a880e79a7b2bd89e2070988 /app/controllers
parentab605e6d31f637e8b1cea15dd7fc929cd7e51919 (diff)
Corrige errores en AddressesController
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/api/addresses_controller.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/app/controllers/api/addresses_controller.rb b/app/controllers/api/addresses_controller.rb
index dbd77d9..834f721 100644
--- a/app/controllers/api/addresses_controller.rb
+++ b/app/controllers/api/addresses_controller.rb
@@ -9,6 +9,16 @@ module Api
render json: serialized_collection.serializable_hash, status: :ok
end
+ def show
+ @address = current_user_account.addresses.find_by(id: params[:id])
+
+ if @address.nil?
+ render status: :not_found
+ else
+ render json: serialized_object.serializable_hash, status: :ok
+ end
+ end
+
def create
@service = Addresses::CreateAddressService.new(current_user_account, service_params)
@@ -40,7 +50,8 @@ module Api
render json: serialized_object.serializable_hash, status: :ok
end
rescue ActiveRecord::RecordNotUnique
- render json: { error_message: 'Ya cuenta con esta dirección' }, status: :unprocessable_entity
+ @address = current_user_account.addresses.find(params[:id])
+ render json: serialized_object.serializable_hash, status: :ok
end
end