aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/result.rb
diff options
context:
space:
mode:
authorbogdanvlviv <bogdanvlviv@gmail.com>2018-09-20 12:16:51 +0300
committerbogdanvlviv <bogdanvlviv@gmail.com>2018-09-20 12:25:01 +0300
commit80e31d217e798c2b440732a71e07db1cdc87ff87 (patch)
treef39bb4f161edbc58d6744d71200c77c2e477966d /activerecord/lib/active_record/result.rb
parentf1dcfc6ccb9ceb0bfa76819acc2c3ed1bc691ef8 (diff)
downloadrails-80e31d217e798c2b440732a71e07db1cdc87ff87.tar.gz
rails-80e31d217e798c2b440732a71e07db1cdc87ff87.tar.bz2
rails-80e31d217e798c2b440732a71e07db1cdc87ff87.zip
Make `ActiveRecord::Result#to_a` as alias to `ActiveRecord::Result#to_ary`
`ActiveRecord::Result#to_a` was introduced in #33912. I would prefer to make `to_a` as alias to the `to_ary` because: - It would be clear for users from https://edgeapi.rubyonrails.org/classes/ActiveRecord/Result.html that `to_a` and `to_ary` are the same - For us it would take less efforts in case if we needed to change the docs or implementation, since the methods are the same Follow up #33912
Diffstat (limited to 'activerecord/lib/active_record/result.rb')
-rw-r--r--activerecord/lib/active_record/result.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/result.rb b/activerecord/lib/active_record/result.rb
index 453331e163..da6d10b6ec 100644
--- a/activerecord/lib/active_record/result.rb
+++ b/activerecord/lib/active_record/result.rb
@@ -65,11 +65,6 @@ module ActiveRecord
end
end
- # Returns an array of hashes representing each row record.
- def to_a
- hash_rows
- end
-
def to_hash
ActiveSupport::Deprecation.warn(<<-MSG.squish)
`ActiveRecord::Result#to_hash` has been renamed to `to_a`.
@@ -91,6 +86,8 @@ module ActiveRecord
hash_rows
end
+ alias :to_a :to_ary
+
def [](idx)
hash_rows[idx]
end