在Ruby on rails下使用Think Sphinx时出错 [英] Error while using Thinking Sphinx under Ruby on Rails
本文介绍了在Ruby on rails下使用Think Sphinx时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Think-Sphinx作为RoR应用程序的插件,但出现以下错误:
#的未定义方法`Define_index‘
可能是什么?
型号
class Group < ActiveRecord::Base
belongs_to :retailer_product
has_many :group_ranges, :dependent => :destroy
has_many :group_clients, :dependent => :destroy
has_many :group_notifications, :dependent => :destroy
define_index do
indexes retailer_product.review
indexes retailer_product.retailer.retailer_name
indexes retailer_product.product.pr_id
indexes retailer_product.product.product_name
indexes retailer_product.product.product_tags.tag.tag, :as => :ptag #indexes tag.tag
indexes retailer_product.product.product_properties.property.value, :as => :pvalue #indexes product_property.value
indexes retailer_product.product.brand.brand, :as => :product_brand
has :id
where "groups.active=1"
group_by "groups.id"
end
end
Environment.rb
# Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
ENV['RAILS_RELATIVE_URL_ROOT']="/project"
Rails::Initializer.run do |config|
config.time_zone = 'UTC'
end
提前谢谢!
推荐答案
config.gem(
'thinking-sphinx',
:lib => 'thinking_sphinx',
:version => '1.3.11'
)
请阅读:
http://freelancing-god.github.com/ts/en/installing_thinking_sphinx.html
编辑环境后重新启动应用程序。rb
这篇关于在Ruby on rails下使用Think Sphinx时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文