How to create a raw sql seed migration

rails-migrations, ruby-on-rails-3

Solution

Using the following code you'll achieve what you want

connection = ActiveRecord::Base.connection();
connection.execute("SQL COMMANDS")

That would need to go in your seed.rb file

Then you'd need to execute `rake db:seed`

Problem

I created City model and I have all cities that I need to store in city table in a .sql file. This sql file has all 'insert into' statements needed. So, I would like to create a seed file to add all cities from the sql file. How could I seed a database using sql commands? Thanks!

Original source