mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #21678 from ronakjangir47/array_to_formatted_s_docs
Added Examples in docs for internal behavior of Array#to_formatted_s [ci skip]
This commit is contained in:
commit
d1a43d32e6
1 changed files with 3 additions and 1 deletions
|
@ -85,7 +85,9 @@ class Array
|
|||
# Extends <tt>Array#to_s</tt> to convert a collection of elements into a
|
||||
# comma separated id list if <tt>:db</tt> argument is given as the format.
|
||||
#
|
||||
# Blog.all.to_formatted_s(:db) # => "1,2,3"
|
||||
# Blog.all.to_formatted_s(:db) # => "1,2,3"
|
||||
# Blog.none.to_formatted_s(:db) # => "null"
|
||||
# [1,2].to_formatted_s # => "[1, 2]"
|
||||
def to_formatted_s(format = :default)
|
||||
case format
|
||||
when :db
|
||||
|
|
Loading…
Reference in a new issue