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: post_processing_rule.rb
    path of file: ./repos/texterify/app/models
    
    the code of the file until where you have to start completion: class PostProcessingRule < ApplicationRecord
  scope :order_by_name, -> { order(arel_table['name'].lower.asc) }

  validates :name, presence: true
  valid
    
  def no_duplicate_rules_for_project
    project = Project.find(project_id)
    post_processing_rule = project.post_processing_rules.find_by(name: name)

    if post_processing_rule.present?
      updating_post_processing_rule = post_processing_rule.id == id

      if !updating_post_processing_rule
        errors.add(:name, :taken)
      end