Created
December 9, 2010 15:12
-
-
Save maxschulze/734805 to your computer and use it in GitHub Desktop.
Proposal for Radio Locations / Stations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## | |
| # This way a radio location/station can have many cities, countries and continents, e.g. | |
| # for a global online radio channel. | |
| # | |
| # A Radio Location can have just a city or country etc. | |
| # | |
| class RadioStation | |
| belongs_to :radio_location | |
| end | |
| class RadioLocation | |
| has_and_belongs_to_many :cities | |
| has_and_belongs_to_many :states | |
| has_and_belongs_to_many :countries | |
| has_and_belongs_to_many :continents | |
| has_many :radio_stations | |
| # attributes: street, zipcode, latitude, longitude | |
| end | |
| class City | |
| belongs_to :state | |
| has_and_belongs_to_many :radio_locations | |
| # attributes: name | |
| # maybe semantic data here | |
| end | |
| class State | |
| belongs_to :country | |
| has_many :cities | |
| has_and_belongs_to_many :radio_locations | |
| # attributes: name | |
| # maybe semantic data here | |
| end | |
| class Country | |
| belongs_to :continent | |
| has_many :states | |
| has_and_belongs_to_many :radio_locations | |
| # attributes: name, code | |
| # maybe semantic data here | |
| end | |
| class Continent | |
| has_many :countries | |
| has_and_belongs_to_many :radio_locations | |
| # attributes: name | |
| # maybe semantic data here | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment