<commit_before>class Album < ActiveRecord::Base
  validates :user_id, presence: true

  belongs_to :user
  has_many :album_images, -> { order('position DESC') }, :dependent => :destroy
  has_many :images, through: :album_images

  include IdentifiableByKey

  def add_images(current_user, image_ids)
    begin
      ActiveRecord::Base.transaction do
        images = current_user.images.find(image_ids)

        images.each do |image|
          self.album_images.create(:image_id => image.id)
        end
      end
      true
    rescue ActiveRecord::RecordNotFound => exception
      false
    end
  end

  def has_images?
    self.album_images.count > 0
  end
end
<commit_msg>Override to_param<commit_after>class Album < ActiveRecord::Base
  validates :user_id, presence: true

  belongs_to :user
  has_many :album_images, -> { order('position DESC') }, :dependent => :destroy
  has_many :images, through: :album_images

  include IdentifiableByKey

  def add_images(current_user, image_ids)
    begin
      ActiveRecord::Base.transaction do
        images = current_user.images.find(image_ids)

        images.each do |image|
          self.album_images.create(:image_id => image.id)
        end
      end
      true
    rescue ActiveRecord::RecordNotFound => exception
      false
    end
  end

  def has_images?
    self.album_images.count > 0
  end

  def to_param
    key
  end
end

{'fraction_non_alphanumeric': 0.08489208633093526, 'fraction_numerical': 0.0014388489208633094, 'mean_word_length': 3.0318840579710145, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '3469948', 'n_tokens_mistral': 431, 'n_tokens_neox': 421, 'n_words': 103}