aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorKevin Dougherty <kdough@kdough.net>2016-02-19 09:04:04 -0800
committerKevin Dougherty <kdough@kdough.net>2016-02-19 09:04:04 -0800
commit95c24e9f9aed36b2ee650dbf779cf56dcdbbede3 (patch)
treed5002187aa8d3c3d38a642bc381e0b13320d05ba /activerecord/lib
parentbe08291ebfc247e3357c221f0a06bc91cd5e52d4 (diff)
downloadrails-95c24e9f9aed36b2ee650dbf779cf56dcdbbede3.tar.gz
rails-95c24e9f9aed36b2ee650dbf779cf56dcdbbede3.tar.bz2
rails-95c24e9f9aed36b2ee650dbf779cf56dcdbbede3.zip
Add methods to array delegation from `Relation`
Delegation of some `Array` methods was removed in commit 9d79334. That change did add explicit delegation of a few methods that `Array` has but which aren't on `Enumerable`. However, a few non-mutation methods were omitted. This adds `Array` delegation of `#in_groups`, `#in_groups_of`, `#shuffle` and `#split`. This allows things like `MyThing.all.in_groups_of(3) { ... }` to continue working as they did before commit 9d79334.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/relation/delegation.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/delegation.rb b/activerecord/lib/active_record/relation/delegation.rb
index e4e5d63006..2b1ac42395 100644
--- a/activerecord/lib/active_record/relation/delegation.rb
+++ b/activerecord/lib/active_record/relation/delegation.rb
@@ -37,7 +37,8 @@ module ActiveRecord
# for each different klass, and the delegations are compiled into that subclass only.
delegate :to_xml, :to_yaml, :length, :collect, :map, :each, :all?, :include?, :to_ary, :join,
- :[], :&, :|, :+, :-, :sample, :shuffle, :reverse, :compact, to: :to_a
+ :[], :&, :|, :+, :-, :sample, :reverse, :compact, :in_groups, :in_groups_of,
+ :shuffle, :split, to: :to_a
delegate :table_name, :quoted_table_name, :primary_key, :quoted_primary_key,
:connection, :columns_hash, :to => :klass