Created
January 28, 2014 10:23
Revisions
-
pkuczynski created this gist
Jan 28, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ desc 'Load data from SQL file' task :load_data => :environment do puts 'Loading db/data.sql' sql = File.read("#{Rails.root}/db/data.sql") statements = sql.split(/;$/) statements.pop # the last empty statement statements.each do |statement| ActiveRecord::Base.connection.execute(statement) end end