lib/beerdb/models/beer.rb in beerdb-0.8.2 vs lib/beerdb/models/beer.rb in beerdb-0.9.0

- old
+ new

@@ -1,26 +1,26 @@ # encoding: UTF-8 -module BeerDb::Models +module BeerDb::Model class Beer < ActiveRecord::Base extend TextUtils::TagHelper # will add self.find_tags, self.find_tags_in_attribs!, etc. # NB: use extend - is_<type>? become class methods e.g. self.is_<type>? for use in # self.create_or_update_from_values extend TextUtils::ValueHelper # e.g. self.is_year?, self.is_region?, self.is_address?, is_taglist? etc. - belongs_to :country, :class_name => 'WorldDb::Models::Country', :foreign_key => 'country_id' - belongs_to :region, :class_name => 'WorldDb::Models::Region', :foreign_key => 'region_id' - belongs_to :city, :class_name => 'WorldDb::Models::City', :foreign_key => 'city_id' + belongs_to :country, :class_name => 'WorldDb::Model::Country', :foreign_key => 'country_id' + belongs_to :region, :class_name => 'WorldDb::Model::Region', :foreign_key => 'region_id' + belongs_to :city, :class_name => 'WorldDb::Model::City', :foreign_key => 'city_id' - belongs_to :brand, :class_name => 'BeerDb::Models::Brewery', :foreign_key => 'brand_id' - belongs_to :brewery, :class_name => 'BeerDb::Models::Brewery', :foreign_key => 'brewery_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::Models::Tagging' - has_many :tags, :through => :taggings, :class_name => 'WorldDb::Models::Tag' + 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' } ######################## # begin extras/extension drink/bookmar/user @@ -189,6 +189,6 @@ end # method create_or_update_from_values end # class Beer -end # module BeerDb::Models +end # module BeerDb::Model