Hi all,
I have a fairly simple migration below.
All looks good to me and throws no errors but the d/b is not getting the
new values. The final print cmd prints out the correct data. Any clues
please ?
web_referrers = WebReferrer.find :all
web_referrers.each do |web_referrer|
print web_referrer.ID,"\n"
print web_referrer.ip_addresses,"\n"
web_referrer.ip_addresses += ',203.190.235.96/27'
web_referrer.ip_addresses.slice!('202.177.212.144/28')
web_referrer.ip_addresses.sub!(/, *,/, ',')
web_referrer.ip_addresses = tempIp
print web_referrer.ip_addresses, "\n"
web_referrer.save!
print "Saved ", web_referrer.ID, "\n"
end
Sorry,
I have been playing with solutions.
I should have deleted the line
web_referrer.ip_addresses = tempIp
Regards,
Bill
Bill Comer wrote:
Hi all,
I have a fairly simple migration below.
All looks good to me and throws no errors but the d/b is not getting the
new values. The final print cmd prints out the correct data. Any clues
please ?
web_referrers = WebReferrer.find :all
web_referrers.each do |web_referrer|
print web_referrer.ID,"\n"
print web_referrer.ip_addresses,"\n"
web_referrer.ip_addresses += ',203.190.235.96/27'
web_referrer.ip_addresses.slice!('202.177.212.144/28')
web_referrer.ip_addresses.sub!(/, *,/, ',')
web_referrer.ip_addresses = tempIp
print web_referrer.ip_addresses, "\n"
web_referrer.save!
print "Saved ", web_referrer.ID, "\n"
end
Sussed it.
I am supporting legacy code and the primary key column is ID not id.
The cure was:
class WebReferrer < ActiveRecord::Base
set_table_name :fred
set_primary_key :ID
end