Perform these db tasks using a single function

hello frnds

I want to perform these tasks using a single function in ror

first select all records from table 1
then create table named 2
then copy the records to table 2
and finally delete all records from table 1

Please let me know how to do it with ROR

Thanks

Dhaval P.