1
0
Fork 0
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:
Yves Senn 2015-09-22 10:25:14 +02:00
commit d1a43d32e6

View file

@ -86,6 +86,8 @@ class Array
# comma separated id list if <tt>:db</tt> argument is given as the format. # 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) def to_formatted_s(format = :default)
case format case format
when :db when :db