diff db/seeds.rb @ 98:596803cb34fc luisf

Created a model for the Intitutions; Created a seed file to initialize the db;
author Luis Figueira <luis.figueira@eecs.qmul.ac.uk>
date Thu, 16 Dec 2010 14:55:37 +0000
parents
children da7cba64948d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/seeds.rb	Thu Dec 16 14:55:37 2010 +0000
@@ -0,0 +1,15 @@
+# This file should contain all the record creation needed to seed the database with its default values.
+# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
+#
+# Examples:
+#   
+#   cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
+#   Major.create(:name => 'Daley', :city => cities.first)
+
+Institution.delete_all
+
+open("db/seed_data/institutions.txt") do |institutions|
+  institutions.read.each_line do |institution|
+    Institution.create(:name => institution.chomp)
+  end
+end
\ No newline at end of file