<commit_before>require 'active_model'
require 'i18n/string'

class ActiveModel::Error < I18n::String
  attr_reader :model, :attribute

  def initialize(subject = nil, options = {})
    values = options[:values] || {}
    @model, @attribute = values.values_at(:model, :attribute)
    super(subject || type, options)
  end

  protected

    def scope
      ['errors.messages', super].compact.join('.')
    end
end<commit_msg>change Error#translate_options to match 2.3.3 scopes<commit_after>require 'active_model'
require 'i18n/string'

class ActiveModel::Error < I18n::String
  attr_reader :model, :attribute

  def initialize(subject = nil, options = {})
    values = options[:values] || {}
    @model, @attribute = values.values_at(:model, :attribute)
    super(subject || type, options)
  end

  def <=>(other)
    to_s <=> other
  end

  protected

    def scope
      ['errors.messages', super].compact.join('.')
    end

    def translate_options
      scope = self.scope.gsub('.messages', '')
      { :raise => true, :scope => scope, :default => :"messages.#{subject}" }.merge(options)
    end
end
{'fraction_non_alphanumeric': 0.14777878513145964, 'fraction_numerical': 0.009972801450589302, 'mean_word_length': 3.7381974248927037, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3363095', 'n_tokens_mistral': 352, 'n_tokens_neox': 341, 'n_words': 83}