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.
13 lines
307 B
13 lines
307 B
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
|
|
|