[#4182] Relate deliverables to issues.
This commit is contained in:
1 parent
92eb7d261f
commit
cb9740571b
3 files changed
+14
No files matched your search
@@ -6,6 +6,7 @@ class Deliverable < ActiveRecord::Base
|
|||||||
belongs_to :manager, :class_name => 'User', :foreign_key => 'manager_id'
|
belongs_to :manager, :class_name => 'User', :foreign_key => 'manager_id'
|
||||||
has_many :labor_budgets
|
has_many :labor_budgets
|
||||||
has_many :overhead_budgets
|
has_many :overhead_budgets
|
||||||
|
has_many :issues
|
||||||
|
|
||||||
accepts_nested_attributes_for :labor_budgets
|
accepts_nested_attributes_for :labor_budgets
|
||||||
accepts_nested_attributes_for :overhead_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_belong_to :manager
|
||||||
should_have_many :labor_budgets
|
should_have_many :labor_budgets
|
||||||
should_have_many :overhead_budgets
|
should_have_many :overhead_budgets
|
||||||
|
should_have_many :issues
|
||||||
|
|
||||||
should_validate_presence_of :title
|
should_validate_presence_of :title
|
||||||
should_validate_presence_of :type
|
should_validate_presence_of :type
|
||||||
|
|||||||
Reference in new issue
Block a user