Skip to content

Commit 3ce3c21

Browse files
committed
no use for set, no need to to_ary, reduce extra objects
1 parent 6e14feb commit 3ce3c21

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

activerecord/lib/active_record/associations/association_collection.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
require 'set'
21
require 'active_support/core_ext/array/wrap'
32

43
module ActiveRecord
@@ -75,7 +74,7 @@ def first(*args)
7574
find(:first, *args)
7675
else
7776
load_target unless loaded?
78-
args = args[1..-1] if args.first.kind_of?(Hash) && args.first.empty?
77+
args.shift if args.first.kind_of?(Hash) && args.first.empty?
7978
@target.first(*args)
8079
end
8180
end
@@ -93,7 +92,7 @@ def last(*args)
9392
def to_ary
9493
load_target
9594
if @target.is_a?(Array)
96-
@target.to_ary
95+
@target
9796
else
9897
Array.wrap(@target)
9998
end

0 commit comments

Comments
 (0)