Associating a deliverable with a project. #1135
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
class Deliverable < ActiveRecord::Base
|
||||
belongs_to :project
|
||||
end
|
||||
|
||||
9
db/migrate/002_add_project_id_to_deliverables.rb
Normal file
9
db/migrate/002_add_project_id_to_deliverables.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class AddProjectIdToDeliverables < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :deliverables, :project_id, :integer
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :deliverables, :project_idx
|
||||
end
|
||||
end
|
||||
@@ -5,3 +5,9 @@ describe Deliverable do
|
||||
Deliverable.new.should be_valid
|
||||
end
|
||||
end
|
||||
|
||||
describe Deliverable, 'associations' do
|
||||
it "should have a project association" do
|
||||
Deliverable.reflect_on_association(:project).should_not be( nil )
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user