Humorous Moment
2006-10-20
I use the Money gem quite a bit in my Rails applications. One thing I needed was to often add or substract one penny from an amount. So, I did like all good programmers should do:
lib/money_extensions.rb
1 class Money 2 Penny = Money.new(1).freeze 3 end
Turns out that when using the constant, it ends up looking like this:
1 amount -= Money::Penny
I never knew I’d have a Bond Girl in my Rails code :)
blog comments powered by Disqus