You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is due to faulty logic in geokit_finder_adapter:
# A proxy to an instance of a finder adapter, inferred from the connection's adapter.
def geokit_finder_adapter
@geokit_finder_adapter ||= begin
unless Adapters.const_defined?(connection.adapter_name.camelcase)
filename = connection.adapter_name.downcase
require File.join("geokit-rails", "adapters", filename)
end
klass = Adapters.const_get(connection.adapter_name.camelcase)
if klass.class == Module
# For some reason Mysql2 adapter was defined in Adapters.constants but was Module instead of a Class
filename = connection.adapter_name.downcase
require File.join("geokit-rails", "adapters", filename)
# Re-init the klass after require
klass = Adapters.const_get(connection.adapter_name.camelcase)
end
klass.load(self) unless klass.loaded || skip_loading
klass.new(self)
rescue LoadError
raise UnsupportedAdapter, "`#{connection.adapter_name.downcase}` is not a supported adapter."
end
end
The call to const_defined and const_get should pass the extra 'false' parameter - otherwise they will find the top-level '::Mysql2' constant and return that instead. ie:
irb(main):001:0> module X1; module X2; end; end
irb(main):004:0> module X2; end
irb(main):005:0> module X3; end
irb(main):006:0> X3.const_defined?('X2')
=> true
irb(main):007:0> X3.const_defined?('X2', false)
=> false
irb(main):008:0> X1.const_defined?('X2', false)
=> true
The text was updated successfully, but these errors were encountered:
This is due to faulty logic in geokit_finder_adapter:
The call to const_defined and const_get should pass the extra 'false' parameter - otherwise they will find the top-level '::Mysql2' constant and return that instead. ie:
The text was updated successfully, but these errors were encountered: