module JamRuby
  class UserMatchEmailSending < ActiveRecord::Base
    
    serialize :sent_user_ids, Array

    def sent_user_ids=(ids)
      ids = ids.split(',') if ids.is_a?(String)
      super(ids)
    end

    def completed?
      !completed_at.nil?
    end

    def self.most_recent
      UserMatchEmailSending.order(created_at: :desc).first
    end
  end
end