我在Gemfile中启用了Refinery Search和Refinery博客扩展,并运行rake db:migrate
,rake db:seed
。
根据Refinery Search说明文件,将以下内容添加到config/application.rb
config.to_prepare do
Refinery.searchable_models = [Refinery::Blog]
end
还使用
创建了app/decorators/models/refinery/blog_decorator.rb
Refinery::Blog.class_eval do
acts_as_indexed :fields => [:title, :body, :custom_teaser]
end
以上示例来自:http://refinerycms.com/guides/extending-model
但是当我尝试运行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'
我在这里可以缺少什么?非常感谢你!
答案 0 :(得分:0)
实际上Refinery::Blog
是一个模块而不是模型。理想情况下,您应该使用Refinery::Blog::Post
。