From 20b5e57dd35baaefa91be4dfae1ee5b608b191d5 Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Tue, 16 Dec 2025 09:40:33 +0100 Subject: [PATCH] Prefer if/else over early return --- saas/app/controllers/stripe/webhooks_controller.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/saas/app/controllers/stripe/webhooks_controller.rb b/saas/app/controllers/stripe/webhooks_controller.rb index a111a1931..bf00fc23f 100644 --- a/saas/app/controllers/stripe/webhooks_controller.rb +++ b/saas/app/controllers/stripe/webhooks_controller.rb @@ -4,12 +4,12 @@ class Stripe::WebhooksController < ApplicationController skip_before_action :verify_authenticity_token def create - event = verify_webhook_signature - return head :bad_request unless event - - dispatch_stripe_event(event) - - head :ok + if event = verify_webhook_signature + dispatch_stripe_event(event) + head :ok + else + head :bad_request + end end private