Skip to content

Instantly share code, notes, and snippets.

@benschwarz
Forked from benaskins/gist:114606
Created May 20, 2009 07:37
Show Gist options
  • Save benschwarz/114678 to your computer and use it in GitHub Desktop.
Save benschwarz/114678 to your computer and use it in GitHub Desktop.
postcodes = FasterCSV.read(data_source_for("postcodes.csv"))
postcodes.each do |(post_code, name, state_name, _, _, _, _, _, _, category)|
if category.squish == "Delivery Area"
post_code = sprintf("%04d", post_code.to_i)
state = State.find_or_create_by_name(state_name)
Locality.create(:post_code => post_code, :name => name, :state => state)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment