提交 3ce3c219 编写于 作者: A Aaron Patterson

no use for set, no need to to_ary, reduce extra objects

上级 6e14feb9
require 'set'
require 'active_support/core_ext/array/wrap'
module ActiveRecord
......@@ -75,7 +74,7 @@ def first(*args)
find(:first, *args)
else
load_target unless loaded?
args = args[1..-1] if args.first.kind_of?(Hash) && args.first.empty?
args.shift if args.first.kind_of?(Hash) && args.first.empty?
@target.first(*args)
end
end
......@@ -93,7 +92,7 @@ def last(*args)
def to_ary
load_target
if @target.is_a?(Array)
@target.to_ary
@target
else
Array.wrap(@target)
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册