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.
This commit is contained in:
Ted Johansson 2023-10-27 14:52:23 +08:00 committed by GitHub
parent 66084b3ce8
commit ac70ef929f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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