Election results in the London Borough of Sutton.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

19 lines
410 B

  1. require 'rubygems'
  2. require 'csv'
  3. require 'dm-core'
  4. require 'dm-validations'
  5. require 'dm-timestamps'
  6. require 'lib/models'
  7. # Import wards
  8. CSV::Reader.parse(File.open('wards.csv', 'rb')) do |row|
  9. p row
  10. puts Ward.create!(
  11. 'ons_id' => row[0],
  12. 'name' => row[1],
  13. 'slug' => Ward.slugify(row[1]),
  14. 'constituency_id' => row[2] == 'Carshalton and Wallington' ? 1 : 2
  15. )
  16. end