Group countries per continent

Hi guys,

I have a table that has a country column (:string). Now I need to group
together all the countries that are in Europe.

Any ideas on how I would approach this? (quickfix wise)

Regards,

Vincent

On Mon, Apr 26, 2010 at 7:51 AM, Vincent B. [email protected]
wrote:

I have a table that has a country column (:string). Now I need to group
together all the countries that are in Europe.

Any ideas on how I would approach this? (quickfix wise)

  1. Add continent as an attribute to Country, access collections via
    named scope

  2. Create a Continent model where Continent has_many countries,
    Country belongs_to continent

HTH,

Hassan S. ------------------------ [email protected]
twitter: @hassan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs