You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: missing_non_null_constraint.rb
    path of file: ./repos/active_record_doctor/lib/active_record_doctor/detectors
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require "active_record_doctor/detectors/base"

module ActiveRecordDoctor
  module Detectors
    class MissingNonNullConstraint < Base # :nodoc:
      @description = "detect columns whose presence is always validated but isn't enfor
    
      def non_null_needed?(model, column)
        belongs_to = model.reflect_on_all_associations(:belongs_to).find do |reflection|
          reflection.foreign_key == column.name ||
            (reflection.polymorphic? && reflection.foreign_type == column.name)
        end

        required_presence_validators(model).any? do |validator|
          attributes = validator.attributes

          attributes.include?(column.name.to_sym) ||
            (belongs_to && attributes.include?(belongs_to.name.to_sym))
        end
      end