我使用 pg_search gem 在我的 rails 应用程序中进行搜索。我的应用程序中的主要模型是:
class Book < ActiveRecord::Base
include PgSearch
pg_search_scope :search_everywhere, against: [:author, :title, :description]
end
它与完美配合
@books = Book.search_everywhere(params[:search])
在 BooksController 的索引操作中。然后我添加了 gem 'globalize':
translates :title, :author, :publisher, :description, :fallbacks_for_empty_translations => true
现在搜索不起作用。
Book.search_everywhere(params[:search])
找不到任何字段。有人使用 pg_search gem 和 globalize gem 吗?