提交 b7cce1c0 编写于 作者: S Sean Griffin

Ensure enum scopes work properly with STI and inheritance

The code was changed to call `where` on a specific class in 813c8c07,
but no reasoning was given and I can't see any good reason why we would
need to do that. This will ensure that the method is called on whatever
class the scope is called on.

Fixes #23013
上级 5854de38
......@@ -187,7 +187,7 @@ def enum(definitions)
# scope :active, -> { where status: 0 }
klass.send(:detect_enum_conflict!, name, value_method_name, true)
klass.scope value_method_name, -> { klass.where name => value }
klass.scope value_method_name, -> { where(name => value) }
end
end
defined_enums[name.to_s] = enum_values
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册