Actions
Improvement #501
openAvoid warnings on Enumeration.system, Group.sorted, and User.sorted
Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Compatible Redmine Version:
Pull Request Link:
Description
W, [2021-08-31T09:17:26.837276 #86] WARN -- : Creating scope :system. Overwriting existing method Enumeration.system.
W, [2021-08-31T09:17:27.044029 #86] WARN -- : Creating scope :sorted. Overwriting existing method Group.sorted.
W, [2021-08-31T09:17:27.050843 #86] WARN -- : Creating scope :sorted. Overwriting existing method User.sorted.
Here is an example of how to fix those warnings:
class Reservation < ApplicationRecord
enum status: [:pending, :requested, :confirmed, :checked_out, :returned, :cancelled]
singleton_class.undef_method :open # hide Kernel.open, avoiding a warning when defining scope :open
scope :open, -> { where(status: [:pending, :requested]) }
end
Actions