From 43bdc8a928d3557195b93f8e0272743c0d73ee42 Mon Sep 17 00:00:00 2001 From: sdsykes Date: Thu, 12 Mar 2009 11:27:18 +0200 Subject: [PATCH] Do not use scrooge for inner joined queries because scrooge won't track other tables columns --- lib/scrooge.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/scrooge.rb b/lib/scrooge.rb index 8490fce..dcb9c76 100644 --- a/lib/scrooge.rb +++ b/lib/scrooge.rb @@ -134,7 +134,8 @@ def find_by_sql(sql) # Only scope n-1 rows by default. # Stephen: Temp. relaxed the LIMIT constraint - please advise. def scope_with_scrooge?( sql ) - sql =~ scrooge_select_regex && column_names.include?(self.primary_key.to_s) #&& sql !~ /LIMIT 1$/ + sql =~ scrooge_select_regex && column_names.include?(self.primary_key.to_s) && + sql !~ /INNER JOIN/ #&& sql !~ /LIMIT 1$/ end # Populate the storage for a given callsite signature