acts_as_sphinx.rb第14行:
[code]
default_options = {:host => 'localhost', :port => 3312, :index => name.tableize}
[/code]
这里查询的index名字直接用了name.tableize,没有考虑使用set_table_name来设置一些遗留数据库表的情况,所以应该改为:
[code]
default_options = {:host => 'localhost', :port => 3312, :index => table_name || name.tableize}
[/code]
[code]
default_options = {:host => 'localhost', :port => 3312, :index => name.tableize}
[/code]
这里查询的index名字直接用了name.tableize,没有考虑使用set_table_name来设置一些遗留数据库表的情况,所以应该改为:
[code]
default_options = {:host => 'localhost', :port => 3312, :index => table_name || name.tableize}
[/code]
本文针对acts_as_sphinx.rb文件中索引名称的设定方式进行了修改,为了解决遗留数据库表的问题,将索引名字的生成方式从默认的name.tableize更改为table_name||name.tableize。
559

被折叠的 条评论
为什么被折叠?



