Sha256: d941bcc7c68902c34addcd503ea32bece5d178482621e6289ff6af2c16f48cf7

Contents?: true

Size: 704 Bytes

Versions: 2

Compression:

Stored size: 704 Bytes

Contents

module BeerDb::Models

class Brewery < ActiveRecord::Base

  self.table_name = 'breweries'

  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'

  has_many   :beers,   :class_name => 'BeerDb::Models::Beer',     :foreign_key => 'brewery_id'

  has_many :taggings, :as => :taggable, :class_name => 'WorldDb::Models::Tagging'
  has_many :tags,  :through => :taggings, :class_name => 'WorldDb::Models::Tag'

end # class Brewery


end # module BeerDb::Models

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
beerdb-0.3.0 lib/beerdb/models/brewery.rb
beerdb-0.2.0 lib/beerdb/models/brewery.rb