由于空间适配器错误,Heroku将无法启动

时间:2013-09-12 02:27:27

标签: ruby-on-rails ruby heroku postgis

我正在尝试将一个Rails应用程序部署到Heroku,它使用PostGIS来获取一些基于位置的信息。我按照Heroku关于在我的数据库上安装PostGIS(https://devcenter.heroku.com/articles/postgis)的文档,但我遇到了来自spatial_adapter gem的以下错误:

/app/vendor/bundle/ruby/1.9.1/gems/spatial_adapter-1.2.0/lib/spatial_adapter/railtie.rb:4:in `block in <class:Railtie>': undefined method `[]' for nil:NilClass (NoMethodError)
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /app/config/environment.rb:5:in `<top (required)>'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

有关导致此错误的原因的任何想法?提前谢谢!

1 个答案:

答案 0 :(得分:4)

spatial_adapter gem的github页面表示不再维护此适配器,而是应该使用RGeo gem。我使用以下教程将我的应用程序转换为新的gem:http://www.waratuman.com/2012/10/26/postgis_and_rails/

问题解决了!