instance method
detect_enum_conflict!
Ruby on Rails 6.1.7.10
Since v4.1.16 PrivateSignature
detect_enum_conflict!(enum_name, method_name, klass_method = false)
No documentation comment.
Parameters
-
enum_namereq -
method_namereq -
klass_methodopt = false
Source
# File activerecord/lib/active_record/enum.rb, line 281
def detect_enum_conflict!(enum_name, method_name, klass_method = false)
if klass_method && dangerous_class_method?(method_name)
raise_conflict_error(enum_name, method_name, type: "class")
elsif klass_method && method_defined_within?(method_name, Relation)
raise_conflict_error(enum_name, method_name, type: "class", source: Relation.name)
elsif !klass_method && dangerous_attribute_method?(method_name)
raise_conflict_error(enum_name, method_name)
elsif !klass_method && method_defined_within?(method_name, _enum_methods_module, Module)
raise_conflict_error(enum_name, method_name, source: "another enum")
end
end
Defined in activerecord/lib/active_record/enum.rb line 281
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Enum