Added issues relationship to deliverables. #1135
This commit is contained in:
@@ -3,6 +3,7 @@ class Deliverable < ActiveRecord::Base
|
|||||||
validates_presence_of :subject
|
validates_presence_of :subject
|
||||||
|
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
|
has_many :issues
|
||||||
|
|
||||||
# TODO: mocked
|
# TODO: mocked
|
||||||
def score
|
def score
|
||||||
|
|||||||
9
db/migrate/006_add_deliverable_id_to_issues.rb
Normal file
9
db/migrate/006_add_deliverable_id_to_issues.rb
Normal file
@@ -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
|
||||||
@@ -14,6 +14,10 @@ describe Deliverable, 'associations' do
|
|||||||
it "should have a project association" do
|
it "should have a project association" do
|
||||||
Deliverable.reflect_on_association(:project).should_not be( nil )
|
Deliverable.reflect_on_association(:project).should_not be( nil )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should have an issues association" do
|
||||||
|
Deliverable.reflect_on_association(:issues).should_not be( nil )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe Deliverable, '.overhead' do
|
describe Deliverable, '.overhead' do
|
||||||
|
|||||||
Reference in New Issue
Block a user