<commit_before>class Activity < ActiveRecord::Base
  STATE_DEVELOPMENT = 'development'
  STATE_VERSIONED = 'versioned'
  STATE_DEPLOYED = 'deployed'

  belongs_to :app
  has_many :versions
  has_many :changes, :order => "created_at DESC"

  has_many :db_instance_activity
  has_many :db_instances, :through => :db_instance_activity

  validates_associated :db_instances
  validates_presence_of :name, :schema

  named_scope :latest, lambda { |limit| {:order => 'updated_at DESC', :limit => limit} }

  def development!
    update_attribute(:state, STATE_DEVELOPMENT)<commit_msg>Add TODO<commit_after>class Activity < ActiveRecord::Base
  STATE_DEVELOPMENT = 'development'
  STATE_VERSIONED = 'versioned'
  STATE_DEPLOYED = 'deployed'

  belongs_to :app
  has_many :versions
  has_many :changes, :order => "created_at DESC"

  has_many :db_instance_activity
  has_many :db_instances, :through => :db_instance_activity

  validates_associated :db_instances
  validates_presence_of :name, :schema

  # FIXME: Add before_save check state

  named_scope :latest, lambda { |limit| {:order => 'updated_at DESC', :limit => limit} }

  def development!
    update_attribute(:state, STATE_DEVELOPMENT)
{'fraction_non_alphanumeric': 0.09739714525608732, 'fraction_numerical': 0.0, 'mean_word_length': 5.659217877094972, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '1512175', 'n_tokens_mistral': 420, 'n_tokens_neox': 390, 'n_words': 89}