From ac70ef929f45403775174345dc671c21564dd384 Mon Sep 17 00:00:00 2001 From: Ted Johansson Date: Fri, 27 Oct 2023 14:52:23 +0800 Subject: [PATCH] DEV: Remove deprecated #pluck_first freedom patch (#24130) The #pluck_first method got a replacement in ActiveRecord core named #pick. After a bunch of replacements in core and plugins, we are now ready to retire this freedom patch. --- lib/freedom_patches/pluck_first.rb | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 lib/freedom_patches/pluck_first.rb diff --git a/lib/freedom_patches/pluck_first.rb b/lib/freedom_patches/pluck_first.rb deleted file mode 100644 index 616cbad93d5..00000000000 --- a/lib/freedom_patches/pluck_first.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class ActiveRecord::Relation - def pluck_first(*attributes) - Discourse.deprecate("`#pluck_first` is deprecated, use `#pick` instead.") - pick(*attributes) - end - - def pluck_first!(*attributes) - Discourse.deprecate("`#pluck_first!` is deprecated without replacement.") - items = pick(*attributes) - - raise_record_not_found_exception! if items.nil? - - items - end -end - -module ActiveRecord::Querying - delegate(:pluck_first, :pluck_first!, to: :all) -end