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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sorry, I have been playing with solutions. I should have deleted the line> web_referrer.ip_addresses = tempIpRegards, 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-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---