From f90868c18da4223c43cadda73f49f4f5bfde207a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guitaut?= Date: Wed, 24 Jun 2009 18:09:47 +0800 Subject: [PATCH] 'value' was interpolated in a string for attribute_condition call (AR 2.3.2 part) This was a mistake, getting SQL like "column = NULL" instead of "column IS NULL". Signed-off-by: Pete Deffendol --- lib/mysql_spatial_adapter.rb | 2 +- lib/post_gis_adapter.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mysql_spatial_adapter.rb b/lib/mysql_spatial_adapter.rb index 44df534..46f34c9 100644 --- a/lib/mysql_spatial_adapter.rb +++ b/lib/mysql_spatial_adapter.rb @@ -73,7 +73,7 @@ def self.get_rails2_conditions(attrs) table_name = quoted_table_name end begin # this works in AR 2.3.2 and later versions, it might work in earlier versions - this way of checking avoids using version numbers - attribute_condition("#{table_name}.#{connection.quote_column_name(attr)}", "#{value}") + attribute_condition("#{table_name}.#{connection.quote_column_name(attr)}", value) rescue ArgumentError # for some earlier versions of AR it definitely breaks "#{table_name}.#{connection.quote_column_name(attr)} #{attribute_condition(value)}" end diff --git a/lib/post_gis_adapter.rb b/lib/post_gis_adapter.rb index 5276c5f..a12b80c 100644 --- a/lib/post_gis_adapter.rb +++ b/lib/post_gis_adapter.rb @@ -58,7 +58,7 @@ def self.get_conditions(attrs) end else begin # this works in AR 2.3.2 and later versions, it might work in earlier versions - this way of checking avoids using version numbers - attribute_condition("#{table_name}.#{connection.quote_column_name(attr)}", "#{value}") + attribute_condition("#{table_name}.#{connection.quote_column_name(attr)}", value) rescue ArgumentError # for some earlier versions of AR it definitely breaks "#{table_name}.#{connection.quote_column_name(attr)} #{attribute_condition(value)}" end