diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-08-19 00:57:16 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-19 00:57:16 -0300 |
commit | 3760efe00dccfabea36d3d7d244a26a2d8f16eb5 (patch) | |
tree | 0c4ef4d8ba3d422344b84217c9825dbbed7afe53 /activerecord/lib/active_record | |
parent | 0db945ac9564d8e7e559397cdeeef148d2aec704 (diff) | |
parent | 70821dea5ac3e726fa0b81db0fa16c80ff7c897f (diff) | |
download | rails-3760efe00dccfabea36d3d7d244a26a2d8f16eb5.tar.gz rails-3760efe00dccfabea36d3d7d244a26a2d8f16eb5.tar.bz2 rails-3760efe00dccfabea36d3d7d244a26a2d8f16eb5.zip |
Merge pull request #25989 from kamipo/remove_unnecessary_select_for_collection_proxy
Remove unnecessary `select` method for `CollectionProxy`
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations/collection_association.rb | 8 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/collection_proxy.rb | 9 |
2 files changed, 6 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index b8d1e0cea4..e17ca81867 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -82,14 +82,6 @@ module ActiveRecord @target = [] end - def select(*fields) - if block_given? - load_target.select.each { |e| yield e } - else - scope.select(*fields) - end - end - def find(*args) if block_given? load_target.find(*args) { |*block_args| yield(*block_args) } diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb index 4634afdf69..926defbb47 100644 --- a/activerecord/lib/active_record/associations/collection_proxy.rb +++ b/activerecord/lib/active_record/associations/collection_proxy.rb @@ -53,6 +53,12 @@ module ActiveRecord @association.loaded? end + ## + # :method: select + # + # :call-seq: + # select(*fields, &block) + # # Works in two ways. # # *First:* Specify a subset of fields to be selected from the result set. @@ -106,9 +112,6 @@ module ActiveRecord # # #<Pet id: 2, name: "Spook">, # # #<Pet id: 3, name: "Choo-Choo"> # # ] - def select(*fields, &block) - @association.select(*fields, &block) - end # Finds an object in the collection responding to the +id+. Uses the same # rules as ActiveRecord::Base.find. Returns ActiveRecord::RecordNotFound |