<commit_before>class Beer < ActiveRecord::Base

  acts_as_indexed :fields => [:name, :description, :awards, :brewery]

  validates_presence_of :name
  validates_uniqueness_of :name
	validates_presence_of :beer_category_id

  has_many :beer_pricings
  has_many :beer_sizes, :through => :beer_pricings
  has_many :awards
  
  accepts_nested_attributes_for :beer_pricings, :allow_destroy => true, :reject_if => lambda { |record| record[:price].empty? }
  
  default_scope :order => :position
  named_scope :live, :conditions => {:published => true}
  named_scope :pending, :conditions => {:published => false}
  named_scope :bottles, :conditions => ["bottle_price IS NOT NULL"]
  named_scope :drafts, :conditions => ["draft_price_4oz IS NOT NULL OR draft_price_12oz IS NOT NULL OR draft_price_16oz IS NOT NULL or draft_price_20oz IS NOT NULL"]
  named_scope :haymarket, :conditions => {:brewery => 'Haymarket'}
  named_scope :not_haymarket, :conditions => ["brewery IS NOT 'Haymarket'"]
  named_scope :by_name, :order => :name<commit_msg>Trying another SQL format to avoid mysql error.<commit_after>class Beer < ActiveRecord::Base

  acts_as_indexed :fields => [:name, :description, :awards, :brewery]

  validates_presence_of :name
  validates_uniqueness_of :name
	validates_presence_of :beer_category_id

  has_many :beer_pricings
  has_many :beer_sizes, :through => :beer_pricings
  has_many :awards
  
  accepts_nested_attributes_for :beer_pricings, :allow_destroy => true, :reject_if => lambda { |record| record[:price].empty? }
  
  default_scope :order => :position
  named_scope :live, :conditions => {:published => true}
  named_scope :pending, :conditions => {:published => false}
  named_scope :bottles, :conditions => ["bottle_price IS NOT NULL"]
  named_scope :drafts, :conditions => ["draft_price_4oz IS NOT NULL OR draft_price_12oz IS NOT NULL OR draft_price_16oz IS NOT NULL or draft_price_20oz IS NOT NULL"]
  named_scope :haymarket, :conditions => {:brewery => 'Haymarket'}
  named_scope :not_haymarket, :conditions => ["brewery != Haymarket"]
  named_scope :by_name, :order => :name
{'fraction_non_alphanumeric': 0.11296472831267874, 'fraction_numerical': 0.00667302192564347, 'mean_word_length': 5.950331125827814, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, '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': '2125442', 'n_tokens_mistral': 721, 'n_tokens_neox': 689, 'n_words': 182}