Return to Snippet

Revision: 3065
at May 31, 2007 11:54 by fortuity


Initial Code
countries = Country.find(:all)
for country in countries  
    begin
      tzc = TZInfo::Country.get(country.code.upcase)
    rescue 
      puts "can't find TZInfo for #{country.code.upcase}"
      next
    end
    puts tzc.name
    for zone in tzc.zone_names
      puts country.code.upcase
      puts zone
      CountryTimeZone.create(:parent_id => country.id, :name => zone)
    end
end

Initial URL


Initial Description


Initial Title
Time Zones By Country Using Rails TZInfo

Initial Tags
textmate, rails

Initial Language
Ruby