mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 07:02:46 +08:00
DEV: Don't polute all ActiveRecord classes (#15103)
`pending`, `approved`, `rejected`, `ignored`, and `deleted` scope method were accessible on all model classes… 😂
Fixes `Creating scope :pending. Overwriting existing method DiscoursePostEvent::EventDate.pending.` warnings.
This commit is contained in:
parent
73db60ad2a
commit
1441226b1a
|
@ -80,7 +80,7 @@ class Reviewable < ActiveRecord::Base
|
|||
# Generate `pending?`, `rejected?`, etc helper methods
|
||||
statuses.each do |name, id|
|
||||
define_method("#{name}?") { status == id }
|
||||
self.class.define_method(name) { where(status: id) }
|
||||
singleton_class.define_method(name) { where(status: id) }
|
||||
end
|
||||
|
||||
def self.default_visible
|
||||
|
|
Loading…
Reference in New Issue
Block a user