2.2 has the new number_with_precision implementation which after the number takes :precision, :separator, and :delimiter hash arguments instead of just a precision integer, and the old argument format has been deprecated.
Are we really on the right track deprecating things like this? It feels like deprecation for the sake of deprecation to me.
I mean, if you’ve got a method called number_with_precision, it seems pretty clear that the normal two arguments would be the number, and the precision. Being able to supply the separator and delimiter is great, but since most people will just set those on the locale (if at all), surely we’re just making people do a bunch of extra typing & change a lot of calls in their existing code for no good reason, merely to get rid of the deprecation?
The code already supports both argument syntaxes, so I think we should just remove the deprecation warning. IMHO, we don’t have to deprecate every time something slightly more flexible comes along if there’s nothing wrong with the old way - provided there’s no confusion between the old & new syntax or semantics.
I should probably explain the change because I was the one who
introduced it in the first place.
The reason for the changes to the NumberHelper was that I wasn't happy
with them being inconsistent - some helpers would use hashes to supply
optional parameters and some would use a "standard" argument list. In
Rails - and nowadays also in many Ruby libraries, as far as I've seen
- it has become some kind of a best practice to only use fixed
parameters for required parameters (e.g. the number in the number
helpers) and supply optional parameters as an options hash - which is
exactly what all NumberHelper methods do since I made the change. If I
remember correctly, I introduced similar changes in other places in
ActionView.
In short: This is deprecation for the sake of deprecation but for the
sake of consolidating the ActionView helpers API which - in my opinion
- makes plenty of sense and is a valid reason for deprecation, even if
it occasionally results in some verbosity like you indicated.
I hope this explains the change sufficiently. Otherwise maybe Josh
would like to chime in since he was the one who committed it.