Copying Records

If you have two different tables than you would have two different classes (models) to work with. Let say that you have two classes OldThing and NewThing. You want to copy all of the records from the old_things table to the new_things table. You would do it like this:

old_things = OldThing.find(:all, :conditions => my_sql_where_clause) old_things.each do |old_thing|   new_thing.create(old_thing.attributes) end

This would go through each of the records in the old_things table and add them to the new_things table assuming the field names matched up.