Flowdock
method

detect_negative_enum_conditions!

Importance_0
v7.0.0 - Show latest stable - 0 notes - Class: Enum
detect_negative_enum_conditions!(method_names) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/enum.rb, line 310
      def detect_negative_enum_conditions!(method_names)
        return unless logger

        method_names.select { |m| m.start_with?("not_") }.each do |potential_not|
          inverted_form = potential_not.sub("not_", "")
          if method_names.include?(inverted_form)
            logger.warn "Enum element '#{potential_not}' in #{self.name} uses the prefix 'not_'."                " This has caused a conflict with auto generated negative scopes."                " Avoid using enum elements starting with 'not' where the positive form is also an element."
          end
        end
      end
Register or log in to add new notes.