<commit_before>module Sluggable
  extend ActiveSupport::Concern

  included do
    before_validation :generate_slug, if: :generate_slug?

    def self.find_by_slug_or_id(slug_or_id)
      find_by_slug(slug_or_id) || find_by_id(slug_or_id)
    end
  end

  def generate_slug
    self.slug = name.to_s.parameterize
  end
end<commit_msg>Add method find_by_slug_or_id! to Sluggable module<commit_after>module Sluggable
  extend ActiveSupport::Concern

  included do
    before_validation :generate_slug, if: :generate_slug?

    def self.find_by_slug_or_id(slug_or_id)
      find_by_slug(slug_or_id) || find_by_id(slug_or_id)
    end

    def self.find_by_slug_or_id!(slug_or_id)
      find_by_slug(slug_or_id) || find(slug_or_id)
    end
  end

  def generate_slug
    self.slug = name.to_s.parameterize
  end
end
{'fraction_non_alphanumeric': 0.07037037037037037, 'fraction_numerical': 0.0, 'mean_word_length': 4.3355263157894735, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7198514', 'n_tokens_mistral': 313, 'n_tokens_neox': 327, 'n_words': 53}