aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2012-03-16 00:22:19 -0700
committerJosé Valim <jose.valim@gmail.com>2012-03-16 00:22:19 -0700
commitfa7a3aaac734da7efef17039a934154f64144796 (patch)
tree05b3b0fe6aea5f4020338a0b664da1d6af395178 /activerecord/lib
parente61e0c0b0301155d8d184f02f2ad16b341699d4d (diff)
parent9d52b45a5b8ccf8744c1b05d70bd00831cb87526 (diff)
downloadrails-fa7a3aaac734da7efef17039a934154f64144796.tar.gz
rails-fa7a3aaac734da7efef17039a934154f64144796.tar.bz2
rails-fa7a3aaac734da7efef17039a934154f64144796.zip
Merge pull request #5461 from yakko/master
relation .present? and .blank? should not query SELECT COUNT(DISTINCT id)
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/relation.rb4
1 files changed, 4 insertions, 0 deletions
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?