Refinery中的未定义方法::搜索启用时的博客

时间:2022-11-28 14:30:38

I enabled Refinery Search and Refinery Blog extensions in Gemfile and run rake db:migrate, rake db:seed.

我在Gemfile中启用了Refinery Search和Refinery Blog扩展,并运行rake db:migrate,rake db:seed。

And per Refinery Search instructions file, added the following to config/application.rb

并根据Refinery Search指令文件,将以下内容添加到config / application.rb中

 config.to_prepare do
   Refinery.searchable_models = [Refinery::Blog]
 end

And also created app/decorators/models/refinery/blog_decorator.rb with

并且还创建了app / decorators / models / refinery / blog_decorator.rb

 Refinery::Blog.class_eval do
   acts_as_indexed :fields => [:title, :body, :custom_teaser]
 end

Above example is from: http://refinerycms.com/guides/extending-model

以上示例来自:http://refinerycms.com/guides/extending-model

But when I try to run rails c or rails s, there is an error:

但是当我尝试运行rails c或rails s时,出现错误:

=> Ctrl-C to shutdown server
Exiting
/home/bismailov/Desktop/my_docs/Inbox/ror/maqolarefinery/app/decorators/models/refinery/blog_decorator.rb:2:in `block in <top (required)>': 
undefined method `acts_as_indexed' for Refinery::Blog:Module (NoMethodError)
    from /home/bismailov/Desktop/my_docs/Inbox/ror/maqolarefinery/app/decorators/models/refinery/blog_decorator.rb:1:in `class_eval'

What could I be missing here? Thank you a lot!

我在这里可以缺少什么?万分感谢!

1 个解决方案

#1


0  

Actually Refinery::Blog is a module not a model. Ideally you should use Refinery::Blog::Post.

实际上Refinery :: Blog是一个模块而不是模型。理想情况下,您应该使用Refinery :: Blog :: Post。

#1


0  

Actually Refinery::Blog is a module not a model. Ideally you should use Refinery::Blog::Post.

实际上Refinery :: Blog是一个模块而不是模型。理想情况下,您应该使用Refinery :: Blog :: Post。