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: milestone.rb
    path of file: ./repos/gitlabhq/app/models
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

class Milestone < ApplicationRecord
  include AtomicInternalId
  include Sortable
  include Timebox
  include Milestoneish
  include FromUnion
  include Importable
  include IidRoutes
  include UpdatedAtFilterable
  include EachBatch
  include Spammable

  prepend_mod_wit
    
  def self.sort_with_expired_last(method)
    # NOTE: this is a custom ordering of milestones
    # to prioritize displaying non-expired milestones and milestones without due dates
    sorted = reorder(Arel.sql("(CASE WHEN due_date IS NULL THEN 1 WHEN due_date >= CURRENT_DATE THEN 0 ELSE 2 END) ASC"))
    sorted = if method.to_s == 'expired_last_due_date_desc'
               sorted.order(due_date: :desc)
             else
               sorted.order(due_date: :asc)
             end