From 598891c1d33f886f34b76a53f6341a2acc844476 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Sun, 13 May 2012 21:03:38 -0500 Subject: [PATCH] Don't use dynamic finders in this migration. For whatever reason, the dynamic finders aren't available in this migration and so the migration fails. Converting to find(:all, :conditions => {...}) prevents this from not failing. --- db/migrate/030_set_nil_timestamps.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/db/migrate/030_set_nil_timestamps.rb b/db/migrate/030_set_nil_timestamps.rb index 6f2e944c..71ded287 100644 --- a/db/migrate/030_set_nil_timestamps.rb +++ b/db/migrate/030_set_nil_timestamps.rb @@ -1,19 +1,20 @@ class SetNilTimestamps < ActiveRecord::Migration class Project < ActiveRecord::Base; end + class Context < ActiveRecord::Base; end def self.up - Project.find_all_by_created_at(nil).each do |p| + Project.find(:all, :conditions => { :created_at => nil }).each do |p| Project.update( p.id, {:created_at => Time.now.utc} ) end - Project.find_all_by_updated_at(nil).each do |p| + Project.find(:all, :conditions => { :created_at => nil }).each do |p| Project.update( p.id, {:updated_at => Time.now.utc} ) end - Context.find_all_by_created_at(nil).each do |p| + Context.find(:all, :conditions => { :created_at => nil }).each do |p| Context.update( p.id, {:created_at => Time.now.utc} ) end - Context.find_all_by_updated_at(nil).each do |p| + Context.find(:all, :conditions => { :created_at => nil }).each do |p| Context.update( p.id, {:updated_at => Time.now.utc} ) end