<commit_before>module ChooChoo
  class Locomotive < ActiveRecord::Observer

    # TODO: How to add these dynamically?
    observe :post, :comment

    def after_create(record)
      define_recipient(record)
      Carriage.create!(activity_type: 'created', excerpt: "A new #{@recipient_type} was created", recipient_id: @recipient_id, recipient_type: @recipient_type)
    end

    def after_update(record)
      define_recipient(record)
      Carriage.create!(activity_type: 'updated', excerpt: "A #{@recipient_type} was updated", recipient_id: @recipient_id, recipient_type: @recipient_type)
    end

    def after_destroy(record)
      define_recipient(record)
      Carriage.create!(activity_type: 'deleted', excerpt: "A #{@recipient_type} was updated", recipient_id: @recipient_id, recipient_type: @recipient_type)
    end

    def define_recipient(record)
      @recipient_id = record.id
      @recipient_type = record.class.name.demodulize.downcase
    end

  end
end
<commit_msg>Removed Locomotive-model (observer)<commit_after>module ChooChoo
  class Locomotive < ActiveRecord::Observer

  end
end

{'fraction_non_alphanumeric': 0.09683257918552036, 'fraction_numerical': 0.0, 'mean_word_length': 4.642857142857143, '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': '2995191', 'n_tokens_mistral': 372, 'n_tokens_neox': 342, 'n_words': 78}