Refactor: remove hard coded formatter in #show_budget_field.

This commit is contained in:
Eric Davis
2010-07-13 11:42:00 -07:00
parent a1a66146ee
commit 6dcad41646
+4 -2
View File
@@ -48,9 +48,11 @@ module ContractsHelper
def show_budget_field(object, spent_field, total_field, options={})
formatter = options[:format] || :number_to_currency
spent_content = send(formatter, object.send(spent_field))
total_content = send(formatter, object.send(total_field))
show_field(object, spent_field, options.merge(:raw => true)) do
spent_content = number_to_currency(object.send(spent_field))
total_content = number_to_currency(object.send(total_field))
content_tag(:span, h(spent_content), :class => 'spent') +
content_tag(:span, h(total_content), :class => 'budget')