Skip to content

Commit

Permalink
Update document of Range#to_s
Browse files Browse the repository at this point in the history
Rails 7 deprecated to_s(:format) and recommended using to_fs instead. Changed to follow the document.
  • Loading branch information
shmn7iii committed Oct 13, 2022
1 parent 08b3cc3 commit cace877
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions guides/source/active_support_core_extensions.md
Expand Up @@ -3158,15 +3158,15 @@ NOTE: Defined in `active_support/core_ext/regexp.rb`.
Extensions to `Range`
---------------------

### `to_s`
### `to_fs`

Active Support extends the method `Range#to_s` so that it understands an optional format argument. As of this writing the only supported non-default format is `:db`:
Active Support defines `Range#to_fs` as an alternative to `to_s` that understands an optional format argument. As of this writing the only supported non-default format is `:db`:

```ruby
(Date.today..Date.tomorrow).to_s
(Date.today..Date.tomorrow).to_fs
# => "2009-10-25..2009-10-26"

(Date.today..Date.tomorrow).to_s(:db)
(Date.today..Date.tomorrow).to_fs(:db)
# => "BETWEEN '2009-10-25' AND '2009-10-26'"
```

Expand Down

0 comments on commit cace877

Please sign in to comment.