aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2017-02-10 14:05:53 -0500
committerGitHub <noreply@github.com>2017-02-10 14:05:53 -0500
commitdd74cd3c2f3a83016cdc0b7e4ea029aa148852e9 (patch)
treed1bacf64482347e3c10ce6a32d68e1c35a38a6b3 /activerecord
parent6950a973708aa2b77243eddd72130d6d90257bcb (diff)
parent5d509627c63c81d2a05b4eb69a76e19107c3c074 (diff)
downloadrails-dd74cd3c2f3a83016cdc0b7e4ea029aa148852e9.tar.gz
rails-dd74cd3c2f3a83016cdc0b7e4ea029aa148852e9.tar.bz2
rails-dd74cd3c2f3a83016cdc0b7e4ea029aa148852e9.zip
Merge pull request #27904 from kenta-s/add-methods-back-to-array-delegation-from-ar-relation
Delegate `to_sentence` and `to_fomatted_s` to `records`
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/relation/delegation.rb1
-rw-r--r--activerecord/test/cases/relation/delegation_test.rb3
2 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/delegation.rb b/activerecord/lib/active_record/relation/delegation.rb
index f965818ed2..d3ba724507 100644
--- a/activerecord/lib/active_record/relation/delegation.rb
+++ b/activerecord/lib/active_record/relation/delegation.rb
@@ -38,6 +38,7 @@ module ActiveRecord
delegate :to_xml, :encode_with, :length, :collect, :map, :each, :all?, :include?, :to_ary, :join,
:[], :&, :|, :+, :-, :sample, :reverse, :compact, :in_groups, :in_groups_of,
+ :to_sentence, :to_formatted_s,
:shuffle, :split, :index, to: :records
delegate :table_name, :quoted_table_name, :primary_key, :quoted_primary_key,
diff --git a/activerecord/test/cases/relation/delegation_test.rb b/activerecord/test/cases/relation/delegation_test.rb
index d2382b9bb2..49d4aeafc9 100644
--- a/activerecord/test/cases/relation/delegation_test.rb
+++ b/activerecord/test/cases/relation/delegation_test.rb
@@ -32,7 +32,8 @@ module ActiveRecord
:exclude?, :find_all, :flat_map, :group_by, :include?, :length,
:map, :none?, :one?, :partition, :reject, :reverse,
:sample, :second, :sort, :sort_by, :third,
- :to_ary, :to_set, :to_xml, :to_yaml, :join
+ :to_ary, :to_set, :to_xml, :to_yaml, :join,
+ :in_groups, :in_groups_of, :to_sentence, :to_formatted_s
]
ARRAY_DELEGATES.each do |method|