<commit_before>class Approval < ActiveRecord::Base
  belongs_to :item,  :polymorphic => true

  validates_presence_of  :item
  validates_inclusion_of :event, :in => %w(create update)
  validates_inclusion_of :state, :in => %w(pending approved rejected)

  serialize :object

  before_save :can_save?

  def self.owner_model=(model)
    send(:belongs_to, :owner, :class_name => model.to_s)
    @has_owner = true
  end

  def self.has_owner?
    @has_owner || false
  end

  def self.options_for_state
    [
      ['All', 'all'],
      ['Pending', 'pending'],
      ['Approved', 'approved'],
      ['Rejected', 'rejected']
    ]
  end

  def self.options_for_owner
    return [] unless has_owner?
    all(:select => 'DISTINCT(owner_id)', :conditions => 'owner_id IS NOT NULL').map { |row| [row.owner.to_s, row.owner_id] }
  end

  def self.options_for_type
    all(:select => 'DISTINCT(item_type)').map { |row| [row.item_type.classify, row.item_type] }
  end

  def pending?
    state == 'pending'
  end

  def approved?
    state == 'approved'
  end

  def rejected?
    state == 'rejected'
  end

  def locked?
    approved? or rejected?
  end<commit_msg>Removing explicit owner stuff<commit_after>class Approval < ActiveRecord::Base
  belongs_to :item,  :polymorphic => true

  validates_presence_of  :item
  validates_inclusion_of :event, :in => %w(create update)
  validates_inclusion_of :state, :in => %w(pending approved rejected)

  serialize :object

  before_save :can_save?

  def self.options_for_state
    [
      ['All', 'all'],
      ['Pending', 'pending'],
      ['Approved', 'approved'],
      ['Rejected', 'rejected']
    ]
  end

  def self.options_for_type
    all(:select => 'DISTINCT(item_type)').map { |row| row.item_type }
  end

  def pending?
    state == 'pending'
  end

  def approved?
    state == 'approved'
  end

  def rejected?
    state == 'rejected'
  end

  def locked?
    approved? or rejected?
  end
{'fraction_non_alphanumeric': 0.13113061435209086, 'fraction_numerical': 0.0, 'mean_word_length': 3.3846153846153846, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '1346011', 'n_tokens_mistral': 696, 'n_tokens_neox': 665, 'n_words': 159}