class MapCities < ActiveRecord::Migration
def up
TelephoneRecord.all.each do |tel|
phone_record = PhoneRecord.new({
:name => tel.name,
:phone_no => tel.phone_no,
:address => tel.address
})
phone_record.city = City.find_or_create_by_name(tel.selectcity)
phone_record.save
end
drop_table :telephone_records
end
end
when i try to deploy on this state heroku db:migrate it says uninitialized constant MapCities::TelephoneRecord then i changed it to following
class MapCities < ActiveRecord::Migration
def up
create_table :telephone_records do |tel|
phone_record = PhoneRecord.new({
:name => tel.name,
:phone_no => tel.phone_no,
:address => tel.address
})
phone_record.city = City.find_or_create_by_name(tel.selectcity)
phone_record.save
end
drop_table :telephone_records
end
end
now the error is undefined method ‘name’ for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::Tabledefination:0x000000043c17f8>