[#4182] Relate deliverables to issues.
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user