diff options
author | Kevin Dougherty <kdough@kdough.net> | 2016-02-19 09:04:04 -0800 |
---|---|---|
committer | Kevin Dougherty <kdough@kdough.net> | 2016-02-19 09:04:04 -0800 |
commit | 95c24e9f9aed36b2ee650dbf779cf56dcdbbede3 (patch) | |
tree | d5002187aa8d3c3d38a642bc381e0b13320d05ba /activerecord/lib | |
parent | be08291ebfc247e3357c221f0a06bc91cd5e52d4 (diff) | |
download | rails-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.rb | 3 |
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 |