I'm using this Money class in a Rails app of mine:
And in it there is a handy format method
I have an issue with it spitting out 'free' (when the cents value is zero)
though so I want to override the class to return '$0.00' where it would have
returned 'free'. My code is below but it's not working. I get an error like:
private method `orig_format' called for #<Money:0x2507104 @cents=995,
I've tried other incatations and have gotten an error like:
can't convert Array into String
This happened on the line containing `self.orig_format(rules)`
Any ideas on how I should be doing this?
# Reopen Money class to redo the format method to return $0.00 instead of
alias orig_format format
result = self.orig_format(rules)
if result == 'free'
talk mailing list