Refactor: extract methods to a module and class helper, dollarized_attribute

This commit is contained in:
Eric Davis committed 2010-09-23 11:25:16 -07:00
1 parent 83e3023d85
commit 56a38fbd93
5 files changed
+31 -31

No files matched your search

+2 -8
View File
@@ -21,6 +21,8 @@ class Deliverable < ActiveRecord::Base
validates_presence_of :manager
# Accessors
include DollarizedAttribute
dollarized_attribute :total
delegate :name, :to => :contract, :prefix => true, :allow_nil => true
@@ -53,14 +55,6 @@ class Deliverable < ActiveRecord::Base
self.class.to_s.underscore
end
def total=(v)
if v.is_a? String
write_attribute(:total, v.gsub(/[$ ,]/, ''))
else
write_attribute(:total, v)
end
end
def labor_budget_total(date=nil)
labor_budgets.sum(:budget)
end