<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -9,6 +9,20 @@ when 'postgresql'
   require 'post_gis_adapter'
 else
   raise SpatialAdapterNotCompatibleError.new(&quot;Only MySQL and PostgreSQL are currently supported by the spatial adapter plugin.&quot;)
-end
+end
+
+=begin
+# when testing RAILS_ENV isn't set so you'll need to use this style of getting the adapter name
+# [TODO] come back and make sure RAILS_ENV exists when running the plugin tests
+case ActiveRecord::Base.connection.adapter_name
+when 'MySQL'
+  require 'mysql_spatial_adapter'
+when 'PostgreSQL'
+  require 'post_gis_adapter'
+ else
+  raise SpatialAdapterNotCompatibleError.new(&quot;Only MySQL and PostgreSQL are currently supported by the spatial adapter plugin.&quot;)
+ end
+=end
+ 
 
 </diff>
      <filename>init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -71,8 +71,12 @@ ActiveRecord::Base.class_eval do
             table_name = connection.quote_table_name(table_name)
           else
             table_name = quoted_table_name
-          end
-          &quot;#{table_name}.#{connection.quote_column_name(attr)} #{attribute_condition(value)}&quot;
+          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(&quot;#{table_name}.#{connection.quote_column_name(attr)}&quot;, &quot;#{value}&quot;) 
+           rescue ArgumentError # for some earlier versions of AR it definitely breaks
+             &quot;#{table_name}.#{connection.quote_column_name(attr)} #{attribute_condition(value)}&quot; 
+           end 
         end
       end.join(' AND ')
     end</diff>
      <filename>lib/mysql_spatial_adapter.rb</filename>
    </modified>
    <modified>
      <diff>@@ -56,11 +56,13 @@ ActiveRecord::Base.class_eval do
           else
             &quot;#{table_name}.#{connection.quote_column_name(attr)} &amp;&amp; ? &quot; 
           end
-        elsif ActiveRecord::VERSION::STRING.starts_with?(&quot;2.3&quot;)
-          &quot;#{table_name}.#{attribute_condition(connection.quote_column_name(attr), value)}&quot;
-        else
-          &quot;#{table_name}.#{connection.quote_column_name(attr)} #{attribute_condition(value)}&quot;
-        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(&quot;#{table_name}.#{connection.quote_column_name(attr)}&quot;, &quot;#{value}&quot;) 
+         rescue ArgumentError # for some earlier versions of AR it definitely breaks
+          &quot;#{table_name}.#{connection.quote_column_name(attr)} #{attribute_condition(value)}&quot; 
+         end 
+       end   
       end.join(' AND ')
     end
     if ActiveRecord::VERSION::STRING == &quot;1.15.1&quot;</diff>
      <filename>lib/post_gis_adapter.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 adapter: mysql
 database: spatial_adapter_plugin_test
 username: root
-password: 
+password: 55Shani
 host: localhost  </diff>
      <filename>test/db/database_mysql.yml</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +1,7 @@
 adapter: postgresql
-database: spatial_adapter_plugin_test
+database: gem_test
+host: localhost
+#username: postgres
+#password: 
+username: gem_test
+password: gem_test_password</diff>
      <filename>test/db/database_postgis.yml</filename>
    </modified>
    <modified>
      <diff>@@ -58,6 +58,11 @@ class FindMysqlTest &lt; Test::Unit::TestCase
     assert(pts.is_a?(Array))
     assert_equal(1,pts.length)
     assert(pts[0].data == &quot;Point3&quot;)
+  end
+  
+  def test_find_by_non_geom_column_condition
+    pts = Park.find_all_by_data 'Point1'
+    assert(pts,'find by non-geom column is not working')
   end
   
 </diff>
      <filename>test/find_mysql_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -60,6 +60,11 @@ class FindPostgisTest &lt; Test::Unit::TestCase
     assert_equal(2,pts.length)
     assert(pts[0].data == &quot;Point1&quot; ||pts[1].data == &quot;Point1&quot; )
     assert(pts[0].data == &quot;Point2&quot; ||pts[1].data == &quot;Point2&quot; )
+  end
+  
+  def test_find_by_non_geom_column_condition
+    pts = Park.find_all_by_data 'Point1'
+    assert(pts,'find by non-geom column is not working')
   end
   
 </diff>
      <filename>test/find_postgis_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e145bf845a95da6a9c860f5331e3ffd59591e052</id>
    </parent>
  </parents>
  <author>
    <name>John Small</name>
    <email>jds340@gmail.com</email>
  </author>
  <url>http://github.com/fragility/spatial_adapter/commit/9fa21d71c8bad58d64402a424278e83a22352c97</url>
  <id>9fa21d71c8bad58d64402a424278e83a22352c97</id>
  <committed-date>2009-04-23T08:31:12-07:00</committed-date>
  <authored-date>2009-04-23T02:25:53-07:00</authored-date>
  <message>Added tests to cover the Rails 2.3 fail mode on attribute_condition called test_find_by_non_geom_column_condition in both postgis and mysql. Added
the required fix to mysql adapter and changed the fix so that it doesn't depend on Rails 2.3 but will work for any AR version that
uses 2 params for attribute_condition.

The init.rb file has a comment to read if you want to run tests. Remember to change the database*.yml files.

Still to be done;- make sure RAILS_ENV is available when we run tests.

Signed-off-by: Pete Deffendol &lt;pete@mdsc.com&gt;</message>
  <tree>a8bae2ff0d1992a6e6b82525294861a96dee4966</tree>
  <committer>
    <name>Pete Deffendol</name>
    <email>pete@mdsc.com</email>
  </committer>
</commit>
