summaryrefslogtreecommitdiff
path: root/app/controllers/api
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2023-05-01 11:58:21 -0600
committerHombreLaser <sebastian-440@live.com>2023-05-01 11:58:21 -0600
commit01e8e5d12a7bc2ced74701cf7ce6899d1ccf0cd8 (patch)
treefd8e04091a0c31e8b62ac8cae7e8e7f3b6030323 /app/controllers/api
parent0f93b9484887ac5a8c568062c6b6bbe4ac687bb8 (diff)
Añade safe operator
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/products_controller.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/api/products_controller.rb b/app/controllers/api/products_controller.rb
index 59019d0..838a38a 100644
--- a/app/controllers/api/products_controller.rb
+++ b/app/controllers/api/products_controller.rb
@@ -68,7 +68,7 @@ module Api
end
def object_params
- categories = permitted_params[:categories].split(',')
+ categories = permitted_params[:categories]&.split(',')
public_id = SecureRandom.hex(12)
public_id = SecureRandom.hex(12) while Product.exists?(public_id:)
permitted_params.merge(categories:, public_id:)