Pau*_*ulC 13 solr sunspot ruby-on-rails-3 sunspot-rails sunspot-solr
我有一个带有searchable块的模型,如下所示:
class Contact < ActiveRecord::Base
searchable do
text :contact_name, :company_name, :contact_email
end
end
Run Code Online (Sandbox Code Playgroud)
在控制器的index操作中,我正在调用Contact.new,它在页面上给出了一条错误消息,该消息当前正在我们的临时服务器上运行:
未定义的方法`searchable'用于#<Class:0xce0bf80>
堆栈跟踪searchable通过Contact.new控制器中的线指向模型中的块.
当我在本地(网页或控制台)或通过Staging服务器上的控制台运行代码时,此错误不会出现 - 仅在Staging网页上.
Solr服务在Staging服务器上正常运行,并且数据已成功编制索引.关于为什么它不在舞台上打球的任何理论都将被接受.
编辑
在回答Nick的问题时,Gemfile只有Sunspot的这一行: gem 'sunspot_rails'
对于Gemfile.lock,这些是我能看到的包含Sunspot或Solr引用的所有行:
GEM
rsolr (0.12.1)
builder (>= 2.1.2)
sunspot (1.2.1)
escape (= 0.0.4)
pr_geohash (~> 1.0)
rsolr (= 0.12.1)
sunspot_rails (1.2.1)
nokogiri
sunspot (= 1.2.1)
DEPENDENCIES
sunspot_rails
Run Code Online (Sandbox Code Playgroud)
cak*_*ism 13
我有同样的问题,我只需要重启我的rails服务器.简单的解决方案,但如果它不是为某个建议我这样做的其他帖子,我可能会尝试在尝试重新启动服务器之前调试错误更长的时间,呵呵......
在我看来,宝石没有正确加载到您的暂存站点上。如果您可以显示 Gemfile 和 Gemfile.lock 的相关部分,我可以更新更多答案。
\n\n编辑 \xe2\x80\x94 Gemfile 看起来不错。抱歉,如果我无法使用该应用程序,我什么也得不到。向太阳黑子邮件列表报告错误?http://outoftime.github.com/sunspot
\n