geokit / geokit-rails

Official Geokit plugin for Rails/ActiveRecord. Provides location-based goodness for your Rails app. Requires the Geokit gem.
MIT License
1.57k stars 245 forks source link

Geokit::ActsAsMappable::UnsupportedAdapter: `postgresql` is not a supported adapter. #60

Closed kidlab closed 3 years ago

kidlab commented 10 years ago

Brief backtrace:

/gems/geokit-rails-2.0.1/lib/geokit-rails/acts_as_mappable.rb:101 in "rescue in adapter"
/gems/geokit-rails-2.0.1/lib/geokit-rails/acts_as_mappable.rb:95 in "adapter"
/gems/geokit-rails-2.0.1/lib/geokit-rails/acts_as_mappable.rb:322 in "sphere_distance_sql"
/gems/geokit-rails-2.0.1/lib/geokit-rails/acts_as_mappable.rb:193 in "distance_sql"

I'm not sure why this error happens, but sometimes connection.adapter_name returns postgresql instead of PostgreSQL, and so it causes connection.adapter_name.camelcase to return Postgresql. I will inspect more to find the root cause.

For now, we can monkey patch this problem by this:

# ./config/initializers/geokit_rails_patch.rb
require 'geokit-rails/adapters/postgresql'
module Geokit::Adapters
  class Postgresql < PostgreSQL
  end
end

Or dirtier ;)

# ./config/initializers/geokit_rails_patch.rb
require 'geokit-rails/adapters/postgresql'
Geokit::Adapters::Postgresql = Geokit::Adapters::PostgreSQL
mnoack commented 10 years ago

I couldn't see an issue, so your investigation will be interesting. You probably could override activerecord and work out where that variable is being set if it's changing.

ryankopf commented 3 years ago

I am closing all issues that are more than 6 years old now, as the gem has had significant updates and is likely people with these old issues are no longer having the issues. If you are currently still experiencing this issue or need help feel free to submit a new issue, thank you.