parent
0b1ec7a1c5
commit
337885503e
@ -0,0 +1,4 @@
|
||||
class School < ActiveRecord::Base
|
||||
attr_accessible :name, :province
|
||||
has_many :courses
|
||||
end
|
@ -1,5 +0,0 @@
|
||||
class RemoveCityFromSchools < ActiveRecord::Migration
|
||||
def change
|
||||
remove_column :schools, :city
|
||||
end
|
||||
end
|
@ -1,12 +1,10 @@
|
||||
class CreateSchools < ActiveRecord::Migration
|
||||
|
||||
def change
|
||||
create_table :schools do |t|
|
||||
t.string :name
|
||||
t.string :province
|
||||
t.string :city
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class AddSchoolidToCourses < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :courses, :school_id, :integer
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
name:
|
||||
province: MyString
|
||||
|
||||
two:
|
||||
name:
|
||||
province: MyString
|
@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class SchoolTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Loading…
Reference in new issue