2012-12-19 46 views
0

我在我的rails應用程序中使用'sunspot_rails', '~> 2.0.0.pre.120415'進行Solr搜索,並將其部署到heroku(兩個單獨的應用程序)。 它在一個應用程序上正常工作,但在其他應用程序上拋出錯誤。heroku上的sunspot_solr錯誤?

我檢查了heroku環境,發現 - 一個應用程序在雪松堆棧上,ruby版本是1.9.2p290。 (工作正常) 另一個是在竹棧和紅寶石版本是1.9.2p180(拋出錯誤)

那麼,這是ruby版本問題還是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) 
+1

沒有足夠的信息。如何向我們展示錯誤? – Unixmonkey

+0

嗨,檢查錯誤。 – Lucky

回答

0

爲了更加清楚,在adapters.rb(太陽黑子/ LIB /太陽黑子/ adapters.rb)的頂部,添加下列行:

require 'forwardable' 


module Sunspot 
    # 
    # Sunspot works by saving references to the primary key (or natural ID) of 
0

我已經找到了解決辦法。

其實這是一個在heroku上的環境問題。在本地系統上的ruby版本是紅寶石1.9.2p290和在heroku上是紅寶石1.9.2p180。 Ruby 1.9.2p180不包含'可轉向'模塊。所以我只需要在我的應用程序中包含「可轉換」模塊。

+0

你能告訴我們你到底在哪裏準確地包含了什麼模塊。 Thx –

+1

在application.rb中,我添加了這個require'forwardable' – Lucky