Closed kmmndr closed 3 years ago
It seems to be between geokit-rails and sqlite3-ruby as the former is sending a symbol as third argument and the later expecting the third argument to be found as integer in an enum
# lib/geokit-rails/adapters/sqlite.rb
def self.add_numeric(name)
@@connection.create_function name, 1, :numeric do |func, *args|
func.result = yield(*args)
end
end
# lib/sqlite3/database.rb
def create_function name, arity, text_rep=Constants::TextRep::UTF8, &block
define_function_with_flags(name, text_rep) do |*args|
fp = FunctionProxy.new
block.call(fp, *args)
fp.result
end
self
end
Removing the third argument (and keeping UTF8
by default) works as expected
diff --git a/lib/geokit-rails/adapters/sqlite.rb b/lib/geokit-rails/adapters/sqlite.rb
index 1042eff..ae1754c 100644
--- a/lib/geokit-rails/adapters/sqlite.rb
+++ b/lib/geokit-rails/adapters/sqlite.rb
@@ -3,7 +3,7 @@ module Geokit
class SQLite < Abstract
def self.add_numeric(name)
- @@connection.create_function name, 1, :numeric do |func, *args|
+ @@connection.create_function name, 1 do |func, *args|
func.result = yield(*args)
end
end
+1
I have the same problem here, this patch is going to be added to the master?
This is fixed in 2.3.2 now.
Calling
by_distance
scope on sqlite3 produce the following error