mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06: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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user