lib/beerdb/models/beer.rb in beerdb-0.5.1 vs lib/beerdb/models/beer.rb in beerdb-0.5.2

- old
+ new

@@ -11,10 +11,11 @@ belongs_to :brewery, :class_name => 'BeerDb::Models::Brewery', :foreign_key => 'brewery_id' has_many :taggings, :as => :taggable, :class_name => 'WorldDb::Models::Tagging' has_many :tags, :through => :taggings, :class_name => 'WorldDb::Models::Tag' + validates :key, :format => { :with => /^[a-z][a-z0-9]+$/, :message => 'expected two or more lowercase letters a-z or 0-9 digits' } ### support old names (read-only) for now (remove later) def color srm @@ -32,9 +33,13 @@ self.og = value end def self.create_or_update_from_values( new_attributes, values ) + + ## fix: add/configure logger for ActiveRecord!!! + logger = LogKernel::Logger.root + value_tag_keys = [] ### check for "default" tags - that is, if present new_attributes[:tags] remove from hash if new_attributes[:tags].present?