Better way to set geozone codes when seeding

This commit is contained in:
Alberto Miedes Garcés
2016-12-13 12:40:11 +01:00
parent 2a3dfdd595
commit c2006526c9

View File

@@ -34,10 +34,7 @@ Setting.create(key: 'per_page_code', value: "")
Setting.create(key: 'comments_body_max_length', value: '1000')
puts "Creating Geozones"
('A'..'Z').each do |i|
code = "#{i.each_byte.to_a.first}"
Geozone.create(name: "District #{i}", external_code: code, census_code: code)
end
('A'..'Z').each { |i| Geozone.create(name: "District #{i}", external_code: i.ord, census_code: i.ord) }
puts "Creating Users"