<commit_before>class Subscription < ActiveRecord::Base
  enum type: [:body, :search] # FIXME: all?

  validates :email, presence: true, email: true
  validates :type, presence: true
  validates :query, presence: true

  def to_param
    hashids.encrypt(id)
  end

  def self.find_by_hash(hash)
    id = hashids.decrypt(hash).first
    find(id.to_i) # FIXME: test, if i
  end

  def self.hashids
    # FIXME: salt per installation
    Hashids.new('Subscription', 5)
  end
end<commit_msg>fix hashids methods<commit_after>class Subscription < ActiveRecord::Base
  enum type: [:body, :search] # FIXME: all?

  validates :email, presence: true, email: true
  validates :type, presence: true
  validates :query, presence: true

  def to_param
    self.class.hashids.encode(id)
  end

  def self.find_by_hash(hash)
    id = hashids.decode(hash).first
    find(id)
  end

  def self.hashids
    # FIXME: salt per installation
    Hashids.new('Subscription', 5)
  end
end
{'fraction_non_alphanumeric': 0.10602910602910603, 'fraction_numerical': 0.002079002079002079, 'mean_word_length': 3.7438423645320196, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6406782', 'n_tokens_mistral': 331, 'n_tokens_neox': 327, 'n_words': 91}