提交 3760efe0 编写于 作者: R Rafael França 提交者: GitHub

Merge pull request #25989 from kamipo/remove_unnecessary_select_for_collection_proxy

Remove unnecessary `select` method for `CollectionProxy`
......@@ -82,14 +82,6 @@ def reset
@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) }
......
......@@ -53,6 +53,12 @@ def loaded?
@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 @@ def loaded?
# # #<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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册