instance method detect_enum_conflict!

Ruby on Rails 8.0.4

Since v4.1.16 Private

Available in: v4.1.16 v4.2.9 v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

detect_enum_conflict!(enum_name, method_name, klass_method = false)

No documentation comment.

Parameters

enum_name req
method_name req
klass_method opt = false
Source
# File activerecord/lib/active_record/enum.rb, line 375
      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 && method_name.to_sym == :id
          raise_conflict_error(enum_name, method_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 375 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Enum

Type at least 2 characters to search.

↑↓ navigate · open · esc close