instance method
detect_negative_enum_conditions!
Ruby on Rails 6.1.7.10
Since v6.0.6 PrivateSignature
detect_negative_enum_conditions!(method_names)
No documentation comment.
Parameters
-
method_namesreq
Source
# File activerecord/lib/active_record/enum.rb, line 303
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
Defined in activerecord/lib/active_record/enum.rb line 303
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Enum