<commit_before>class Tab < ActiveRecord::Base
  belongs_to :bar
  belongs_to :patron
  has_many :tab_items
end<commit_msg>Add virtual attribute for total owed on tab<commit_after>class Tab < ActiveRecord::Base
  belongs_to :bar
  belongs_to :patron
  has_many :tab_items
  has_many :drinks, through: :tab_items

  def total_owed
    drinks.inject (0) {|sum, drink| sum + drink.price}
  end

end
{'fraction_non_alphanumeric': 0.08121827411167512, 'fraction_numerical': 0.0025380710659898475, 'mean_word_length': 4.8088235294117645, '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': '7511193', 'n_tokens_mistral': 137, 'n_tokens_neox': 139, 'n_words': 39}