From ba608d2cc253d674d31e5d15e0f780b683825fcc Mon Sep 17 00:00:00 2001 From: Bell Isabell Date: Tue, 3 Mar 2026 18:52:13 -0800 Subject: [PATCH] Replace hardcoded slug check with account-level setting - Add sync_to_ghost boolean column to accounts table - Replace hardcoded 'philipithomas' slug check with @account.sync_to_ghost - New accounts default to sync_to_ghost: false - Existing account can be updated via migration or Rails console Closes #26 --- app/controllers/subscription_verifications_controller.rb | 3 +-- db/migrate/20260303185100_add_sync_to_ghost_to_accounts.rb | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20260303185100_add_sync_to_ghost_to_accounts.rb diff --git a/app/controllers/subscription_verifications_controller.rb b/app/controllers/subscription_verifications_controller.rb index 83be079..bc8a2ce 100644 --- a/app/controllers/subscription_verifications_controller.rb +++ b/app/controllers/subscription_verifications_controller.rb @@ -10,8 +10,7 @@ def show return redirect_to '/', alert: 'Link expired - please sign up again' end - if @account.slug == 'philipithomas' - # SubscribeContraptionCoNewsletterJob.perform_later(@subscription.email_address.email) + if @account.sync_to_ghost SubscribeToContraptionGhostJob.perform_later(@subscription.email_address.email) end diff --git a/db/migrate/20260303185100_add_sync_to_ghost_to_accounts.rb b/db/migrate/20260303185100_add_sync_to_ghost_to_accounts.rb new file mode 100644 index 0000000..b005cb0 --- /dev/null +++ b/db/migrate/20260303185100_add_sync_to_ghost_to_accounts.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddSyncToGhostToAccounts < ActiveRecord::Migration[7.1] + def change + add_column :accounts, :sync_to_ghost, :boolean, default: false, null: false + end +end