tag:blogger.com,1999:blog-37792061.post3473004237844496796..comments2023-10-26T06:07:28.172-04:00Comments on Reclusive Geek: A "Best Migration Practice"Jeremyhttp://www.blogger.com/profile/16086849299137461149noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-37792061.post-6896200900265565692007-05-09T22:23:00.000-04:002007-05-09T22:23:00.000-04:00However, in my case, Product.find(:all).each {|p| ...However, in my case, Product.find(:all).each {|p| p.do_it!} threw an exception. <BR/><BR/>Then, to run the migration again (because it didn't complete), it tried to add the column again.Jeremyhttps://www.blogger.com/profile/16086849299137461149noreply@blogger.comtag:blogger.com,1999:blog-37792061.post-40031595220971044142007-05-09T14:08:00.000-04:002007-05-09T14:08:00.000-04:00You can also use the ModelName.reset_column_inform...You can also use the ModelName.reset_column_information information method. ie:<BR/><BR/>def self.up<BR/> add_column :product, :cost, :integer<BR/> Product.reset_column_information<BR/> Product.find(:all).each { |p| # do stuff to p }<BR/>endjnunemakerhttps://www.blogger.com/profile/07691766127950305415noreply@blogger.com