From 3ce3c21997c92cee4123e76d75e39fcfe3d1e209 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 20 Dec 2010 14:40:07 -0800 Subject: [PATCH] no use for set, no need to to_ary, reduce extra objects --- .../lib/active_record/associations/association_collection.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index 1c8541be67..c513e8ab08 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -1,4 +1,3 @@ -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 -- GitLab