[#4477] Added model and migration for FixedBudget.
This commit is contained in:
1 parent
d315252565
commit
7f7e5b3042
5 files changed
+37
No files matched your search
@@ -8,6 +8,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 :fixed_budgets
|
||||||
has_many :issues
|
has_many :issues
|
||||||
|
|
||||||
accepts_nested_attributes_for :labor_budgets
|
accepts_nested_attributes_for :labor_budgets
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
class FixedBudget < ActiveRecord::Base
|
||||||
|
unloadable
|
||||||
|
|
||||||
|
# Associations
|
||||||
|
belongs_to :deliverable
|
||||||
|
|
||||||
|
# Validations
|
||||||
|
|
||||||
|
# Accessors
|
||||||
|
end
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
class CreateFixedBudgets < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
create_table :fixed_budgets do |t|
|
||||||
|
t.string :title
|
||||||
|
t.decimal :budget, :precision => 15, :scale => 4
|
||||||
|
t.string :markup
|
||||||
|
t.text :description
|
||||||
|
t.references :deliverable
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index :fixed_budgets, :deliverable_id
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
drop_table :fixed_budgets
|
||||||
|
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 :fixed_budgets
|
||||||
should_have_many :issues
|
should_have_many :issues
|
||||||
|
|
||||||
should_validate_presence_of :title
|
should_validate_presence_of :title
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
require File.dirname(__FILE__) + '/../test_helper'
|
||||||
|
|
||||||
|
class FixedBudgetTest < ActiveSupport::TestCase
|
||||||
|
should_belong_to :deliverable
|
||||||
|
|
||||||
|
end
|
||||||
Reference in new issue
Block a user