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

This commit is contained in:
Eric Davis
2010-09-23 11:25:16 -07:00
parent 83e3023d85
commit 56a38fbd93
5 changed files with 31 additions and 31 deletions
+2 -7
View File
@@ -7,13 +7,8 @@ class FixedBudget < ActiveRecord::Base
# Validations
# Accessors
def budget=(v)
if v.is_a? String
write_attribute(:budget, v.gsub(/[$ ,]/, ''))
else
write_attribute(:budget, v)
end
end
include DollarizedAttribute
dollarized_attribute :budget
named_scope :by_period, lambda {|date|
if date