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

Merge pull request #26218 from kamipo/remove_unnecessary_length

Remove unnecessary `length` method for collection proxy
......@@ -270,15 +270,6 @@ def size
end
end
# Returns the size of the collection calling +size+ on the target.
#
# If the collection has been already loaded +length+ and +size+ are
# equivalent. If not and you are going to need the records anyway this
# method will take one less query. Otherwise +size+ is more efficient.
def length
load_target.size
end
# Returns true if the collection is empty.
#
# If the collection has been loaded
......
......@@ -802,6 +802,12 @@ def size
@association.size
end
##
# :method: length
#
# :call-seq:
# length()
#
# Returns the size of the collection calling +size+ on the target.
# If the collection has been already loaded, +length+ and +size+ are
# equivalent. If not and you are going to need the records anyway this
......@@ -822,9 +828,6 @@ def size
# # #<Pet id: 2, name: "Spook", person_id: 1>,
# # #<Pet id: 3, name: "Choo-Choo", person_id: 1>
# # ]
def length
@association.length
end
# Returns +true+ if the collection is empty. If the collection has been
# loaded it is equivalent
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册