提交 70821dea 编写于 作者: R Ryuta Kamizono

Remove unnecessary `select` method for `CollectionProxy`

Currently `CollectionProxy` inherits `Relation` and `Relation` includes
`QueryMethods`. This method is completely duplicated.

https://github.com/rails/rails/blob/v5.0.0/activerecord/lib/active_record/relation/query_methods.rb#L271-L275
上级 6568cfd7
......@@ -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.
先完成此消息的编辑!
想要评论请 注册