Extract boilerplate code

This commit is contained in:
Matt-Yorkley
2021-08-16 16:25:17 +01:00
parent 03abc395f2
commit e48b9d84e5

View File

@@ -28,13 +28,17 @@ class SplitCheckoutController < ::BaseController
flash.now[:error] = I18n.t('split_checkout.errors.global')
render operations: cable_car.replace(
selector: "#checkout", html: render_to_string(partial: "split_checkout/checkout", formats: [:html])
"#checkout", partial("split_checkout/checkout")
), status: :unprocessable_entity
end
end
private
def partial(path, options = {})
{ html: render_to_string(partial: path, **options) }
end
def clear_invalid_payments
@order.payments.with_state(:invalid).delete_all
end