From 9d52b45a5b8ccf8744c1b05d70bd00831cb87526 Mon Sep 17 00:00:00 2001 From: Thiago Almeida Date: Fri, 16 Mar 2012 01:14:24 -0300 Subject: [PATCH] relation .present? and .blank? should not query SELECT COUNT(DISTINCT id) --- activerecord/lib/active_record/relation.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 6f39708ec3..ae2dc6872a 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -507,6 +507,10 @@ module ActiveRecord end end + def blank? + to_a.blank? + end + private def references_eager_loaded_tables?