mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 03:54:59 +08:00
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:
parent
66084b3ce8
commit
ac70ef929f
|
@ -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
|
|
Loading…
Reference in New Issue
Block a user