aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2015-09-22 10:25:14 +0200
committerYves Senn <yves.senn@gmail.com>2015-09-22 10:25:14 +0200
commitd1a43d32e615b4a75117151b002266c560ce9061 (patch)
tree204811aa155645b461467dbd2238ac41c0fe8a30 /activesupport
parent2a7e8f54c66dbd65822f2a7135546a240426b631 (diff)
parent192d29f1c7ea16c506c09da2b854d1acdfbc8749 (diff)
downloadrails-d1a43d32e615b4a75117151b002266c560ce9061.tar.gz
rails-d1a43d32e615b4a75117151b002266c560ce9061.tar.bz2
rails-d1a43d32e615b4a75117151b002266c560ce9061.zip
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]
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/array/conversions.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb
index c5cc31abc5..8718b7e1e5 100644
--- a/activesupport/lib/active_support/core_ext/array/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/array/conversions.rb
@@ -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