method
detect_negative_enum_conditions!
rails latest stable - Class:
ActiveRecord::Enum
detect_negative_enum_conditions!(method_names)private
No documentation available.
# File activerecord/lib/active_record/enum.rb, line 394
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