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.
14 lines
307 B
14 lines
307 B
8 years ago
|
require 'geocoder/calculations'
|
||
|
|
||
|
class AddPlaceIdToCity < ActiveRecord::Migration
|
||
|
def change
|
||
|
add_column :cities, :place_id, :string
|
||
|
|
||
|
City.all.each do |c|
|
||
|
location = Geocoder.search(c.address, language: 'en').first
|
||
|
c.place_id = location.data['place_id']
|
||
|
c.save!
|
||
|
end
|
||
|
end
|
||
|
end
|