Skip to content

Instantly share code, notes, and snippets.

@benaskins
Created May 20, 2009 04:11
Show Gist options
  • Save benaskins/114606 to your computer and use it in GitHub Desktop.
Save benaskins/114606 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