Skip to content

Instantly share code, notes, and snippets.

@dcrec1
Created April 29, 2010 15:07
Show Gist options
  • Save dcrec1/383737 to your computer and use it in GitHub Desktop.
Save dcrec1/383737 to your computer and use it in GitHub Desktop.
State of Brazil for Spree
states = <<STATES
28,AC,Acre
28,AL,Alagoas
28,AP,Amapá
28,AM,Amazonas
28,BA,Bahia
28,CE,Ceará
28,ES,Espírito Santo
28,GO,Goiás
28,MA,Maranhão
28,MT,Mato Grosso
28,MS,Mato Grosso do Sul
28,MG,Minas Gerais
28,PA,Pará
28,PB,Paraíba
28,PR,Paraná
28,PE,Pernambuco
28,PI,Piauí
28,RJ,Rio de Janeiro
28,RN,Rio Grande do Norte
28,RS,Rio Grande do Sul
28,RO,Rondônia
28,RR,Roraima
28,SC,Santa Catarina
28,SP,São Paulo
28,SE,Sergipe
28,TO,Tocantins
28,DF,Distrito Federal
STATES
State.transaction do
states.each do |state|
values = state.split ','
State.create! :country_id => values[0], :abbr => values[1], :name => values[2].sub("\n", "")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment