From 106af37a86a6361a4e4fcfcbe6eb3385cf2a0290 Mon Sep 17 00:00:00 2001 From: oleg dashevskii Date: Wed, 16 Jun 2010 11:19:49 +0700 Subject: [PATCH] Fix a bug in ActiveRecord::Associations#using_limitable_reflections This method returned false for any non-empty reflections array, since it used Enumerable#collect. This caused some nasty problems in complex calculation queries with joins. The bug has been introduced in c48a71c7 (the opposite of Enumerable#reject apparently is #select, not #collect). --- activerecord/lib/active_record/associations.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index fcc79b5..3a32581 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1782,7 +1782,7 @@ module ActiveRecord end def using_limitable_reflections?(reflections) - reflections.collect(&:collection?).length.zero? + reflections.none?(&:collection?) end def column_aliases(join_dependency) -- 1.7.0.4