Associating a deliverable with a project. #1135

This commit is contained in:
Eric Davis
2008-05-20 16:09:09 -07:00
parent 9484d41850
commit 439a649b40
3 changed files with 16 additions and 0 deletions

View File

@@ -1,2 +1,3 @@
class Deliverable < ActiveRecord::Base
belongs_to :project
end

View 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

View File

@@ -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