def self.percent(*keys)
keys.each do |key|
define_method(key) do
h.number_with_precision(object.send(key) * 100.0, precision: 1)
end
define_method("display_#{key}") do
h.number_to_percentage(object.send(column_name) * 100.0, precision: 1)
end
end
end
Created
August 8, 2016 16:25
-
-
Save francirp/7ed8218e12fa4d09c4dd1e68e469ab75 to your computer and use it in GitHub Desktop.
Decorators Codeblock 17
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment