[#4477] Added model and migration for FixedBudget.
This commit is contained in:
@@ -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
|
||||
|
||||
10
app/models/fixed_budget.rb
Normal file
10
app/models/fixed_budget.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class FixedBudget < ActiveRecord::Base
|
||||
unloadable
|
||||
|
||||
# Associations
|
||||
belongs_to :deliverable
|
||||
|
||||
# Validations
|
||||
|
||||
# Accessors
|
||||
end
|
||||
19
db/migrate/015_create_fixed_budgets.rb
Normal file
19
db/migrate/015_create_fixed_budgets.rb
Normal 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
|
||||
@@ -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
|
||||
|
||||
6
test/unit/fixed_budget_test.rb
Normal file
6
test/unit/fixed_budget_test.rb
Normal file
@@ -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