<commit_before>class DispatchedService < ActiveRecord::Base
  # Statuses for status column
  # Still executing, has started  
  InProgress = 'in_progress'
  # Queued up, not yet started. Generally used for background services.
  Queued = 'queued'
  # Complete, succesful. May or may not have produced responses, but
  # completed succesfully either way. 
  Successful = 'successful'
  # Failed, and do not advise trying again. 
  FailedFatal = 'failed_fatal' # Complete, failed,
  # Failed, but it might be worth trying again.
  FailedTemporary = 'failed_temporary'
  

  belongs_to :request
  def service=(service)
    self.service_id = service.id
  end

  # For old-time's sake, true can be used for Succesful
  # and false can be used for FailedTemporary (that keeps
  # previous semantics for false intact). 
  def status=(a_status)
    a_status = FailedTemporary if a_status.kind_of?(FalseClass)
    a_status = Successful if a_status.kind_of?(TrueClass)

    @status = a_status
  end
end
<commit_msg>stupid bug, thats not the way you override AR attributes!<commit_after>class DispatchedService < ActiveRecord::Base
  # Statuses for status column
  # Still executing, has started  
  InProgress = 'in_progress'
  # Queued up, not yet started. Generally used for background services.
  Queued = 'queued'
  # Complete, succesful. May or may not have produced responses, but
  # completed succesfully either way. 
  Successful = 'successful'
  # Failed, and do not advise trying again. 
  FailedFatal = 'failed_fatal' # Complete, failed,
  # Failed, but it might be worth trying again.
  FailedTemporary = 'failed_temporary'
  

  belongs_to :request
  def service=(service)
    self.service_id = service.id
  end

  # For old-time's sake, true can be used for Succesful
  # and false can be used for FailedTemporary (that keeps
  # previous semantics for false intact). 
  def status=(a_status)
    a_status = FailedTemporary if a_status.kind_of?(FalseClass)
    a_status = Successful if a_status.kind_of?(TrueClass)

    # NO: @status = a_status
    # Instead, this is how you 'override' an AR attribute:
    write_attribute(:status, a_status)
  end
end

{'fraction_non_alphanumeric': 0.07460611677479147, 'fraction_numerical': 0.0, 'mean_word_length': 3.8626126126126126, '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': '2991937', 'n_tokens_mistral': 674, 'n_tokens_neox': 643, 'n_words': 233}