From dae01d39eaf017c8fb95c25c2cebfafb8da22a01 Mon Sep 17 00:00:00 2001 From: yuenmichelle1 Date: Thu, 22 Aug 2024 13:26:41 -0500 Subject: [PATCH] Update subscription.rb to throw abort on callback chain when false is returned (#361) See: https://www.bigbinary.com/blog/rails-5-does-not-halt-callback-chain-when-false-is-returned --- Gemfile | 2 +- Gemfile.lock | 2 +- Gemfile.next.lock | 2 +- app/models/subscription.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index d2525946..767cba51 100644 --- a/Gemfile +++ b/Gemfile @@ -38,7 +38,7 @@ group :test, :development do gem 'guard-rspec' gem 'pry' gem 'rspec-its' - gem 'rspec-rails' + gem 'rspec-rails', '~> 4.1.2' gem 'spring-commands-rspec' gem 'ten_years_rails' gem 'timecop' diff --git a/Gemfile.lock b/Gemfile.lock index 10739ba8..405b0bec 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -389,7 +389,7 @@ DEPENDENCIES redis (~> 3.3.0) restpack_serializer! rspec-its - rspec-rails + rspec-rails (~> 4.1.2) schema_plus_pg_indexes sidekiq (< 6) sidekiq-congestion (~> 0.1.0) diff --git a/Gemfile.next.lock b/Gemfile.next.lock index 047f39b1..16f22aa6 100644 --- a/Gemfile.next.lock +++ b/Gemfile.next.lock @@ -389,7 +389,7 @@ DEPENDENCIES redis (~> 3.3.0) restpack_serializer! rspec-its - rspec-rails + rspec-rails (~> 4.1.2) schema_plus_pg_indexes sidekiq (< 6) sidekiq-congestion (~> 0.1.0) diff --git a/app/models/subscription.rb b/app/models/subscription.rb index fb25e5ef..32009d85 100644 --- a/app/models/subscription.rb +++ b/app/models/subscription.rb @@ -17,7 +17,7 @@ def preference end def ensure_enabled - preference.enabled? + throw(:abort) unless preference.enabled? end def enabled?