<commit_before>module Tenon
  class ItemAsset < ActiveRecord::Base
    # Validations
    validates_presence_of :asset
    validates_presence_of :item

    # Relationships
    belongs_to :asset
    belongs_to :item, polymorphic: true

    accepts_nested_attributes_for :asset

    after_save :reprocess_asset

    def reprocess_asset
      asset.reload.attachment.reprocess! if asset_id_changed?
    end
  end
end<commit_msg>Remove the requirement of an item on ItemAssets to allow them to be saved before the item is saved<commit_after>module Tenon
  class ItemAsset < ActiveRecord::Base
    # Validations
    validates_presence_of :asset

    # Relationships
    belongs_to :asset
    belongs_to :item, polymorphic: true

    accepts_nested_attributes_for :asset

    after_save :reprocess_asset

    def reprocess_asset
      asset.reload.attachment.reprocess! if asset_id_changed?
    end
  end
end
{'fraction_non_alphanumeric': 0.04550499445061043, 'fraction_numerical': 0.0, 'mean_word_length': 3.7724867724867726, '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': '4014763', 'n_tokens_mistral': 276, 'n_tokens_neox': 265, 'n_words': 73}