Created
May 12, 2011 10:15
-
-
Save franciscoj/968283 to your computer and use it in GitHub Desktop.
Seed the database using sql files
This file contains 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 characters
# db/seeds.rb | |
Dir.glob("#{base_dir}/*.sql").each do |file_name| | |
puts "Seeding #{ file_name }" | |
sql_file = File.new(file_name) | |
while statements = sql_file.gets("") do | |
ActiveRecord::Base.connection.execute(statements) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment