2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Rails7】Railsで数値を3桁で区切る

Last updated at Posted at 2022-01-04

Rails で数値を3桁区切りにする際のメソッド名が変更された。

before

to_s(:delimited) # TypeError: no implicit conversion of Symbol into Integer

after

to_formatted_s(:delimited)

変更の理由としては、Ruby 3.1では to_s のカスタム実装がない場合に高速化がされるが、Railsは多くのコアクラスで to_s をオーバーライドしており高速化が無効になってしまうため。

外部リンク

変更のPR

Deprecate to_s(format) in favor of to_formatted_s(format)

検索上位記事

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?