RubyMoney / money-rails

Integration of RubyMoney - Money with Rails
MIT License
1.79k stars 386 forks source link

Feature: allow to configure (or document) `Monetize.expect_whole_subunits` #701

Open tagliala opened 3 months ago

tagliala commented 3 months ago

Slightly refers to #696

Hello, I was experiencing an issue in a form with the possibility to switch between currencies without decimals (JPY).

As expected as per https://github.com/RubyMoney/monetize?tab=readme-ov-file#usage, inserting 123,456 for JPY, even if , is the thousands separator for JPY resulted in 123, because Monetize allows fractional units by default (which may not be the case)

So I've added Monetize.expect_whole_subunits on the top of the money rails initializer

I'm asking what do you think to have a configuration option documented in Money Rails for this use case, so you can see immediately what is going wrong