Sha256: 25392955321b352f823f5525c17d597d8f7533d41b660e1c76d7eed364d7361d
Contents?: true
Size: 401 Bytes
Versions: 1
Compression:
Stored size: 401 Bytes
Contents
class AddCityIdToUnicoStreets < ActiveRecord::Migration def change add_column :unico_streets, :city_id, :integer add_index :unico_streets, :city_id add_foreign_key :unico_streets, :unico_cities, column: :city_id Street.find_each do |street| neighborhood = street.neighborhoods.first street.update_column :city_id, neighborhood.city_id if neighborhood end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unico-training-7.8.0 | db/migrate/20121025165054_add_city_id_to_unico_streets.rb |