<commit_before>class Event < ActiveRecord::Base
  belongs_to :user
  belongs_to :project
  belongs_to :subject, :polymorphic => true
  
  attr_readonly :project_id, :user_id
  attr_accessible :action, :subject
  
  validates_presence_of :user, :project, :action, :subject_id, :subject_type
  
  before_validation_on_create :inherit_subject_project
  
  protected
    def inherit_subject_project
      self.project_id = subject.try(:project_id)
    end
end<commit_msg>Events should be ordered by last updated at<commit_after>class Event < ActiveRecord::Base
  belongs_to :user
  belongs_to :project
  belongs_to :subject, :polymorphic => true
  
  attr_readonly :project_id, :user_id
  attr_accessible :action, :subject
  
  validates_presence_of :user, :project, :action, :subject_id, :subject_type
  
  before_validation_on_create :inherit_subject_project
  
  default_scope :order => 'updated_at DESC'
  
  protected
    def inherit_subject_project
      self.project_id = subject.try(:project_id)
    end
end
{'fraction_non_alphanumeric': 0.07418397626112759, 'fraction_numerical': 0.0, 'mean_word_length': 4.816091954022989, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '4468953', 'n_tokens_mistral': 329, 'n_tokens_neox': 328, 'n_words': 74}