From 697b966dd7c0c5e19dc2f72ca99b81964d3138a1 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Wed, 21 May 2008 10:22:13 -0700 Subject: [PATCH] Added issues relationship to deliverables. #1135 --- app/models/deliverable.rb | 1 + db/migrate/006_add_deliverable_id_to_issues.rb | 9 +++++++++ spec/models/deliverable_spec.rb | 4 ++++ 3 files changed, 14 insertions(+) create mode 100644 db/migrate/006_add_deliverable_id_to_issues.rb diff --git a/app/models/deliverable.rb b/app/models/deliverable.rb index dffb5fe..a226c4a 100644 --- a/app/models/deliverable.rb +++ b/app/models/deliverable.rb @@ -3,6 +3,7 @@ class Deliverable < ActiveRecord::Base validates_presence_of :subject belongs_to :project + has_many :issues # TODO: mocked def score diff --git a/db/migrate/006_add_deliverable_id_to_issues.rb b/db/migrate/006_add_deliverable_id_to_issues.rb new file mode 100644 index 0000000..b343c45 --- /dev/null +++ b/db/migrate/006_add_deliverable_id_to_issues.rb @@ -0,0 +1,9 @@ +class AddDeliverableIdToIssues < ActiveRecord::Migration + def self.up + add_column :issues, :deliverable_id, :integer + end + + def self.down + remove_column :issues, :deliverable_id + end +end diff --git a/spec/models/deliverable_spec.rb b/spec/models/deliverable_spec.rb index cdae0f3..bf2b170 100644 --- a/spec/models/deliverable_spec.rb +++ b/spec/models/deliverable_spec.rb @@ -14,6 +14,10 @@ describe Deliverable, 'associations' do it "should have a project association" do Deliverable.reflect_on_association(:project).should_not be( nil ) end + + it "should have an issues association" do + Deliverable.reflect_on_association(:issues).should_not be( nil ) + end end describe Deliverable, '.overhead' do