[#4477] Added model and migration for FixedBudget.

This commit is contained in:
Eric Davis
2010-09-09 15:57:58 -07:00
parent d315252565
commit 7f7e5b3042
5 changed files with 37 additions and 0 deletions

View File

@@ -8,6 +8,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 :fixed_budgets
has_many :issues
accepts_nested_attributes_for :labor_budgets

View File

@@ -0,0 +1,10 @@
class FixedBudget < ActiveRecord::Base
unloadable
# Associations
belongs_to :deliverable
# Validations
# Accessors
end

View File

@@ -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

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 :fixed_budgets
should_have_many :issues
should_validate_presence_of :title

View File

@@ -0,0 +1,6 @@
require File.dirname(__FILE__) + '/../test_helper'
class FixedBudgetTest < ActiveSupport::TestCase
should_belong_to :deliverable
end