diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-08 16:06:48 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-08 16:06:48 -0700 |
commit | cb1f80591e130ecb855965cc3af4e8b6ae0e3397 (patch) | |
tree | 3f48a5ddf1b90c4cc15778f5fe9455e65b3851be | |
parent | 4ccf491ec2a09b22827f2c9ba99e311ce18c93eb (diff) | |
download | rails-cb1f80591e130ecb855965cc3af4e8b6ae0e3397.tar.gz rails-cb1f80591e130ecb855965cc3af4e8b6ae0e3397.tar.bz2 rails-cb1f80591e130ecb855965cc3af4e8b6ae0e3397.zip |
refactor to use faster empty?
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 038b18079d..a6a3f3df05 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -12,8 +12,10 @@ module ActiveRecord def includes(*args) args.reject! {|a| a.blank? } + return clone if args.empty? + relation = clone - relation.includes_values = (relation.includes_values + args).flatten.uniq if args.present? + relation.includes_values = (relation.includes_values + args).flatten.uniq relation end |