我在我的rails应用程序中使用'sunspot_rails', '~> 2.0.0.pre.120415'进行Solr搜索,并将其部署到heroku (两个独立的应用程序)上。它在一个应用程序上运行良好,但在另一个应用程序上抛出错误。
我已经检查了heroku环境,发现-一个应用程序在雪松栈和红宝石版本是1.9.2p290。(工作正常)另一个在竹堆上,红宝石版本为1.9.2p180 (抛出错误)
那么,这是红宝石版本问题还是heroku堆栈问题?开发环境上的Ruby版本是1.9.2p290。
误差
$ heroku run rake sunspot:reindex
Running rake sunspot:reindex attached to terminal... up, run.8567
rake aborted!
uninitialized constant Sunspot::Adapters::Registry::Forwardable
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot/adapters.rb:310:in `<class:Registry>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot/adapters.rb:309:in `<module:Adapters>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot/adapters.rb:34:in `<module:Sunspot>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot/adapters.rb:1:in `<top (required)>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot.rb:18:in `block in <top (required)>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot.rb:15:in `each'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot-2.0.0.pre.120925/lib/sunspot.rb:15:in `<top (required)>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot_rails-2.0.0.pre.120925/lib/sunspot/rails.rb:1:in `<top (required)>'
/app/.bundle/gems/ruby/1.9.1/gems/sunspot_rails-2.0.0.pre.120925/lib/sunspot_rails.rb:6:in `<top (required)>'
/app/config/application.rb:7:in `<top (required)>'
/app/Rakefile:4:in `require'
/app/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)发布于 2013-03-23 23:23:31
更清楚的是,在adapters.rb的顶部(黑子/lib/太阳黑子/Adapters.rb)添加以下一行:
require 'forwardable'
module Sunspot
#
# Sunspot works by saving references to the primary key (or natural ID) of发布于 2013-01-14 10:55:08
我已经找到了解决办法。
实际上,这是heroku.On本地系统上的一个环境问题,ruby版本是ruby 1.9.2p290,在heroku上是ruby1.9.2p180。Ruby1.9.2p180不包括“可转发”模块。因此,我只需要在我的应用程序中包括“可转发”模块。
https://stackoverflow.com/questions/13952162
复制相似问题