Having an issue getting a migration to do what I want it to. My
migration file is as follows:
==========================class AddActsAsParanoidFields <
ActiveRecord::Migration
def self.up
add_column :departments, :deleted_at, :datetime
Department.find(:all, :conditions => "name =
''Operations''").each
{|d| d.update_attribute(''deleted_at'', Time.now)}
add_column :employees, :deleted_at, :datetime
Employee.find(:all, :conditions => "active = 0").each {|e|
e.update_attribute(''deleted_at'',Time.now) }
end
def self.down
remove_column :departments, :deleted_at
add_column :employees, :active, :boolean, :default => true, :null =>
false
Employee.find(:all, :conditions => ''deleted_at !=
null'').each {|e|
e.update_attribute(''active'', false)}
end
end
===========================
After I run my migration, I check my database and the Department.find...
and Employee.find... lines haven''t successfully executed. Yet if I
open
up a console window immediately after doing the migration I can copy and
paste those same lines from my code into the console and it works just
the way its supposed to.
Anybody have any ideas why?
Marc
--
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
-~----------~----~----~----~------~----~------~--~---