marksweston / finance

A library for financial calculations in Ruby
https://rubygems.org/gems/finance
Other
217 stars 93 forks source link

sum isn't compatible with rails #5

Closed fringd closed 12 years ago

fringd commented 12 years ago

Rails defines sum as well, and they do a more thorough job of it...

that is, they allow you to specify an Identity besides 0 (we could specify Flt::DecNum('0') for example)

the problem arises from Rails and Finance both trying to define sum on array, but with different signatures.

could we check to see if Array already responds to sum before defining it? or failing that, could we have sum take the same function signature so that the subclassing succeeds? as it is rails apps blow up when they require the finance gem.

wkranec commented 12 years ago

I have redefined sum using method_missing so that it will no longer override other [better] implementations. Hopefully Finance now plays nicely with Rails.