[#4182] Relate deliverables to issues.

This commit is contained in:
Eric Davis
2010-07-07 12:48:41 -07:00
parent 92eb7d261f
commit cb9740571b
3 changed files with 14 additions and 0 deletions
+1
View File
@@ -6,6 +6,7 @@ class Deliverable < ActiveRecord::Base
belongs_to :manager, :class_name => 'User', :foreign_key => 'manager_id'
has_many :labor_budgets
has_many :overhead_budgets
has_many :issues
accepts_nested_attributes_for :labor_budgets
accepts_nested_attributes_for :overhead_budgets
@@ -0,0 +1,12 @@
class AddDeliverableIdToIssues < ActiveRecord::Migration
def self.up
# Skip adding the column if it exists from the Budget plugin
unless Issue.column_names.include?('deliverable_id')
add_column :issues, :deliverable_id, :integer
end
end
def self.down
remove_column :issues, :deliverable_id
end
end
+1
View File
@@ -5,6 +5,7 @@ class DeliverableTest < ActiveSupport::TestCase
should_belong_to :manager
should_have_many :labor_budgets
should_have_many :overhead_budgets
should_have_many :issues
should_validate_presence_of :title
should_validate_presence_of :type