Refactor conditional

CartService#populate already returns the value of the #valid? method by default.
This commit is contained in:
Matt-Yorkley
2021-05-12 16:34:00 +01:00
parent 6abe0b375c
commit 2e96982e60

View File

@@ -3,11 +3,9 @@ class CartController < BaseController
def populate
order = current_order(true)
cart_service = CartService.new(order)
cart_service.populate(params.slice(:variants, :quantity))
if cart_service.valid?
if cart_service.populate(params.slice(:variants, :quantity))
order.cap_quantity_at_stock!
order.recreate_all_fees!