lib/beerdb/models/beer.rb in beerdb-0.9.2 vs lib/beerdb/models/beer.rb in beerdb-0.9.3

- old
+ new

@@ -1,8 +1,9 @@ # encoding: UTF-8 -module BeerDb::Model +module BeerDb + module Model class Beer < ActiveRecord::Base extend TextUtils::TagHelper # will add self.find_tags, self.find_tags_in_attribs!, etc. @@ -15,15 +16,22 @@ belongs_to :city, :class_name => 'WorldDb::Model::City', :foreign_key => 'city_id' belongs_to :brand, :class_name => 'BeerDb::Model::Brewery', :foreign_key => 'brand_id' belongs_to :brewery, :class_name => 'BeerDb::Model::Brewery', :foreign_key => 'brewery_id' - has_many :taggings, :as => :taggable, :class_name => 'WorldDb::Model::Tagging' - has_many :tags, :through => :taggings, :class_name => 'WorldDb::Model::Tag' - validates :key, :format => { :with => /^[a-z][a-z0-9]+$/, :message => 'expected two or more lowercase letters a-z or 0-9 digits' } + ## has_many :taggings, :as => :taggable, :class_name => 'WorldDb::Model::Tagging' + ## has_many :tags, :through => :taggings, :class_name => 'WorldDb::Model::Tag' + has_many :taggings, class_name: 'TagDb::Model::Tagging', :as => :taggable + has_many :tags, class_name: 'TagDb::Model::Tag', :through => :taggings + + + ## fix/todo: move to regex to patterns; see worlddb + validates :key, :format => { :with => /\A[a-z][a-z0-9]+\z/, :message => 'expected two or more lowercase letters a-z or 0-9 digits' } + + ######################## # begin extras/extension drink/bookmar/user has_many :drinks ## :class_name => 'Drink' has_many :notes ## :class_name => 'Note' @@ -189,6 +197,7 @@ end # method create_or_update_from_values end # class Beer -end # module BeerDb::Model + end # module Model +end # module BeerDb