pg_search_scope по двум разным столбцам в одной таблице - PullRequest
0 голосов
/ 30 января 2019

Почему поиск по второму столбцу из текущей таблицы не работает?Кто-нибудь знает, как это исправить?

model.rb

  pg_search_scope :search,
              :against => [:name, :phone_number],
              using: { tsearch: { prefix: true, any_word: true } },
              associated_against: {
                :client => [:name, :phone_number]
              }

console_log

2.5.3 :060 > Client.search("Davis, Lorentzz")

=> #<ActiveRecord::Relation [#<Client id: 100, company_id: 8, name: "Davis, Lorentzz", email: "gdrgrd@fgrd.com", variety: "person", active: nil, created_at: "2019-01-29 11:50:17", updated_at: "2019-01-29 11:50:20", phone_number: "1456455453", organisation: "", office_note: "", special_note: "Special Davis">]> 

2.5.3 :061 > Client.search("1456455453")

=> #<ActiveRecord::Relation []> 
...