<commit_before>class Url < ActiveRecord::Base
  validates_presence_of :viewport_width,
                        :address,
                        :name

  validates_format_of     :address, :with => /https?:\/\/.+/
  validates_uniqueness_of :address

  has_many :snapshots
  has_one  :baseline

  default_scope order(:name)
end<commit_msg>Use slugs for URL links<commit_after>class Url < ActiveRecord::Base
  validates_presence_of :viewport_width,
                        :address,
                        :name

  validates_format_of     :address, :with => /https?:\/\/.+/
  validates_uniqueness_of :address

  has_many :snapshots
  has_one  :baseline

  default_scope order(:name)

  def to_param
    [id, slugify(name)].join('-')
  end

  private

  # @param [String] string to slugify
  # @return [String] slugified version of str
  def slugify(str)
    str.gsub(/['’]/, '').parameterize
  end
end
{'fraction_non_alphanumeric': 0.10901001112347053, 'fraction_numerical': 0.0, 'mean_word_length': 2.5714285714285716, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4393539', 'n_tokens_mistral': 307, 'n_tokens_neox': 284, 'n_words': 65}