From 181c414baa877d748671d03fb09499c10f81ec02 Mon Sep 17 00:00:00 2001
From: Pratik Naik <pratiknaik@gmail.com>
Date: Wed, 10 Mar 2010 11:28:04 +0000
Subject: Fix scope loading issue when the table doesn't exist

---
 activerecord/lib/active_record/relation/predicate_builder.rb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'activerecord/lib')

diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb
index 65e5c0495c..49bf2fefe0 100644
--- a/activerecord/lib/active_record/relation/predicate_builder.rb
+++ b/activerecord/lib/active_record/relation/predicate_builder.rb
@@ -20,7 +20,9 @@ module ActiveRecord
             table = Arel::Table.new(table_name, :engine => @engine)
           end
 
-          attribute = table[column] || Arel::Attribute.new(table, column.to_sym)
+          # TODO : Arel::Table#[] should fallback to using Arel::Attribute if the table/column doesn't exist
+          # attribute = table[column]
+          attribute = Arel::Attribute.new(table, column.to_sym)
 
           case value
           when Array, ActiveRecord::Associations::AssociationCollection, ActiveRecord::NamedScope::Scope
-- 
cgit v1.2.3