# app/decorators/company_decorator.rb
class CompanyDecorator < Draper::Decorator
delegate_all
def budget
h.number_to_currency(object.budget, precision: 0)
end
def actual
h.number_to_currency(object.actual, precision: 0)
end
def percent_budget_spent
h.number_to_percentage(object.percent_budget_spent * 100, precision: 1)
end
end
Created
August 8, 2016 15:35
-
-
Save francirp/bcd2a5d755d1c73f25d0598cdbf89218 to your computer and use it in GitHub Desktop.
Decorators Codeblock 2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment