changeset 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 5467cbbf393b
children dc252f2ddef5
files app/models/institution.rb console/db/seeds.rb db/migrate/20101216140621_create_institutions.rb db/seed_data/institutions.txt db/seeds.rb test/fixtures/institutions.yml test/unit/institution_test.rb
diffstat 7 files changed, 195 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/models/institution.rb	Thu Dec 16 14:55:37 2010 +0000
@@ -0,0 +1,2 @@
+class Institution < ActiveRecord::Base
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/console/db/seeds.rb	Thu Dec 16 14:55:37 2010 +0000
@@ -0,0 +1,9 @@
+# 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)
+
+puts "this is a test"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/migrate/20101216140621_create_institutions.rb	Thu Dec 16 14:55:37 2010 +0000
@@ -0,0 +1,13 @@
+class CreateInstitutions < ActiveRecord::Migration
+  def self.up
+    create_table :institutions do |t|
+      t.string :name
+
+      t.timestamps
+    end
+  end
+
+  def self.down
+    drop_table :institutions
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/db/seed_data/institutions.txt	Thu Dec 16 14:55:37 2010 +0000
@@ -0,0 +1,141 @@
+University of Aberdeen
+University of Abertay Dundee
+Aberystwyth University
+Anglia Ruskin University
+University of the Arts London
+Aston University
+Bangor University
+University of Bath
+Bath Spa University
+University of Bedfordshire
+Birkbeck, University of London
+University of Birmingham
+Birmingham City University
+Birmingham Conservatoire
+University Centre at Blackburn College
+University of Bolton
+Bournemouth University
+University of Bradford
+University of Brighton
+University of Bristol
+Brunel University
+University of Buckingham
+Buckinghamshire New University
+University of Cambridge
+Institute of Cancer Research, University of London
+Canterbury Christ Church University
+Cardiff University
+University of Central Lancashire
+Central School of Speech and Drama, University of London
+University of Chester
+University of Chichester
+City University London
+Courtauld Institute of Art
+Coventry University
+Cranfield University
+University for the Creative Arts
+University of Cumbria
+De Montfort University
+University of Derby
+University of Dundee
+Durham University
+University of East Anglia
+University of East London
+Edge Hill University
+University of Edinburgh
+Edinburgh Napier University
+Institute of Education, University of London
+University of Essex
+University of Exeter
+University of Glamorgan
+University of Glasgow
+Glasgow Caledonian University
+University of Gloucestershire
+Goldsmiths, University of London
+University of Greenwich
+Glynd&#373;r University
+Heriot-Watt University
+University of Hertfordshire
+Heythrop College
+University of Huddersfield
+University of Hull
+Hull York Medical School
+Imperial College London
+Keele University
+University of Kent
+King's College London
+Kingston University
+Lancaster University
+University of Leeds
+Leeds Metropolitan University
+University of Leicester
+University of Lincoln
+University of Liverpool
+Liverpool Hope University
+Liverpool John Moores University
+London Business School
+London College of Music
+London Metropolitan University
+London School of Economics and Political Science
+London School of Hygiene and Tropical Medicine
+London South Bank University
+Loughborough University
+University of Manchester
+Manchester Metropolitan University
+Middlesex University
+Newcastle University
+University of Northampton
+Northumbria University
+University of Nottingham
+Nottingham Trent University
+The Open University
+University of Oxford
+Oxford Brookes University
+Peninsula College of Medicine and Dentistry
+University of Plymouth
+University of Portsmouth
+Queen's University Belfast
+Queen Margaret University
+Queen Mary, University of London
+University of Reading
+The Robert Gordon University, Aberdeen
+Roehampton University
+Royal Academy of Music
+Royal College of Art
+Royal Holloway, University of London
+Royal Veterinary College
+University of St Andrews
+St George's, University of London
+University of Salford
+School of Advanced Study, University of London
+School of Oriental and African Studies
+School of Pharmacy, University of London
+University of Sheffield
+Sheffield Hallam University
+University of Southampton
+Southampton Solent University
+Staffordshire University
+University of Stirling
+University of Strathclyde
+University of Sunderland
+University of Surrey
+University of Sussex
+Swansea Metropolitan University
+Swansea University
+University of Teesside
+Thames Valley University
+University of Ulster
+University College London
+University of Wales
+University of Wales Institute, Cardiff
+University of Wales, Newport
+University of Wales, Trinity Saint David
+University of Warwick
+University of Westminster
+University of the West of England
+University of the West of Scotland
+University of Winchester
+University of Wolverhampton
+University of Worcester
+University of York
+York St John University
--- /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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/fixtures/institutions.yml	Thu Dec 16 14:55:37 2010 +0000
@@ -0,0 +1,7 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+
+one:
+  name: MyString
+
+two:
+  name: MyString
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/unit/institution_test.rb	Thu Dec 16 14:55:37 2010 +0000
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class InstitutionTest < ActiveSupport::TestCase
+  # Replace this with your real tests.
+  test "the truth" do
+    assert true
+  end
+end