Invitation confirmation validator class InvitationConfirmationValidator &lt; ActiveModel::Validator
  def validate(record)
    invitation = Invitation.find_by_url_suffix(record.id)
    if invitation
      if invitation.materialized?
        record.erros.clear
        record.errors[:base] &lt;&lt; "Invitation already materialized"
      end
    else
      record.erros.clear
      record.errors[:base] &lt;&lt; "Invitation does not exist"
    end
  end
end


The above is the code for a Validator. It first checks if an invitation with an ID exists. If it does, it checks whether it has already been used.

The code seems to me more complex than it should be to achieve this simple task. Can its complexity be reduced?
The first thing I would do is assign those strings to constants since they will never change throughout the life of the program.
Also, I'm not sure why you have to clear the errors out when you validate this part of the model. When I run valid? on a model, personally I would like to see ALL of the reasons that the model isn't valid.

class InvitationConfirmationValidator &lt; ActiveModel::Validator
  def validate(record)
    invitation = Invitation.find_by_url_suffix(record.id)
    return record.errors[:base] &lt;&lt; MISSING_INVITE_MESSAGE unless invitation
    return record.errors[:base] &lt;&lt; MATERIALIZED_INVITE_MESSAGE if invitation.materialized?
  end
end