class BaseDecorator < Draper::Decorator
delegate_all
def self.currency(*keys)
keys.each do |key|
define_method(key) do
h.number_with_precision(object.send(key), precision: 2)
end
define_method("display_#{key}") do
h.number_to_currency(object.send(key), precision: 0)
end
end
end
end
Last active
August 8, 2016 16:23
-
-
Save francirp/c76aa661dc88247121465a5429ddcc3d to your computer and use it in GitHub Desktop.
Decorators Codeblock 15
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment