<commit_before>class FixAdjustmentOrderPresence < ActiveRecord::Migration
  def change
    say 'Fixing adjustments without direct order reference'
    Spree::Adjustment.where(order: nil).find_each do |adjustment|
      adjustment.udpate_attributes!(adjustable: adjustment.adjustable.order)
    end
  end
end
<commit_msg>Fixes typo, handles adjustable order without order_id<commit_after>class FixAdjustmentOrderPresence < ActiveRecord::Migration
  def change
    say 'Fixing adjustments without direct order reference'
    Spree::Adjustment.where(order: nil).find_each do |adjustment|
      adjustable = adjustment.adjustable
      if adjustable.is_a? Spree::Order
        adjustment.update_attributes!(order_id: adjustable.id)
      else
        adjustment.update_attributes!(adjustable: adjustable.order)
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.0718562874251497, 'fraction_numerical': 0.0, 'mean_word_length': 4.5, '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': '7149816', 'n_tokens_mistral': 236, 'n_tokens_neox': 229, 'n_words': 57}