We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e72a1fc + 2750e9d commit 5f6b716Copy full SHA for 5f6b716
README.adoc
@@ -1575,6 +1575,25 @@ hash.exclude?(:key)
1575
string.exclude?('substring')
1576
----
1577
1578
+=== Prefer `to_fs` for Formatted Strings [[prefer-to-fs]]
1579
+
1580
+If you're using Rails 7.0 or higher, prefer `to_fs` over `to_formatted_s`. `to_formatted_s` is just too cumbersome for a method used that frequently.
1581
1582
+[source,ruby]
1583
+----
1584
+# bad
1585
+time.to_formatted_s(:db)
1586
+date.to_formatted_s(:db)
1587
+datetime.to_formatted_s(:db)
1588
+42.to_formatted_s(:human)
1589
1590
+# good
1591
+time.to_fs(:db)
1592
+date.to_fs(:db)
1593
+datetime.to_fs(:db)
1594
+42.to_fs(:human)
1595
1596
1597
== Time
1598
1599
=== Time Zone Config [[tz-config]]
0 commit comments