I'm in the process of migrating the data from a Rails 2 application, to a new Rails 3 application. The new database shares a number of columns with the 开发者_JAVA技巧old database, and I'm looking to copy some of the data over from the old database to the new one.
How should I go about this?
If it's a large amount of data what I'd do is dump the data you want into a file, then either in a separate rake task or the seeds.rb file do something like:
sql = **read in your file***
ActiveRecord::Base.connection.execute(sql)
精彩评论