【发布时间】:2016-02-01 21:17:09
【问题描述】:
我已经有了一个空间应用程序(PostGIS + Rails + RGeo)的开端,我的一个模型上有一个 line_string 列。在我的本地机器上一切都很好,问题出在 Heroku web dynos 上,Rails/activerecord 无法识别 RGeo/PostGIS line_string 类型。
每次部署后,第一次加载模型时,我都会在日志中看到以下内容:
app[web.1]: unknown OID 17059: failed to recognize type of 'line_string'. It will be treated as String.
然后,如果我向 STDOUT 添加一些日志记录,我可以看到:
mymodel.line_string.class # String
RGeo::Feature::Geometry.check_type(mymodel.line_string) # false
但是,如果我使用 Rails 控制台 (heroku run rails c production) 运行一次性测功机,一切都很好。我看到了我期望的输出:
irb(main):001:0> mymodel.line_string.class
=> RGeo::Geographic::SphericalLineStringImpl
irb(main):002:0> RGeo::Feature::Geometry.check_type(mymodel.line_string)
=> true
在worker dynos下也可以。
什么会导致未知的 OID 错误?为什么一次性和工人 dyno 能够完美地使用这个专栏,而 web dyno 却不能?
【问题讨论】:
标签: ruby-on-rails heroku postgis rgeo