active_supportで数値の変換でも楽をする

active_supportのto_sも非常に使い手のある パーセンテージ 100.to_s(:percentage, precision: 2) #=> "100.00%" 100.to_s(:percentage, precision: 0) #=> "100%" 金額 100_000_000.to_s(:currency) #=> "$100,000,000.00" 通貨単位はnumber_to_currencyと同じくunitで指定します。 100_000_000.to_s(:currency, precisio…