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: user.rb
    path of file: ./repos/plots2/app/models
    
    the code of the file until where you have to start completion: class UniqueUsernameValidator < ActiveModel::Validator
  def validate(record)
    if User.find_by(username: record.usernam
    
  def send_digest_email
    if has_tag('digest:daily')
      @nodes = content_followed_in_period(1.day.ago, Time.current)
      @frequency = Frequency::DAILY
    else
      @nodes = content_followed_in_period(1.week.ago, Time.current)
      @frequency = Frequency::WEEKLY
    end