Skip to content

Remote selects in console

Petr Marek edited this page May 26, 2020 · 1 revision

To make an association select remote, add remote: true to the view.

= f.association :my_association, remote: true

You also need to have a by_query scope defined on the autocompleted model.

class My::Model < ApplicationRecord
  ...

  pg_search_scope :by_query,
                  against: %i[field1 field2],
                  ignoring: :accents,
                  using: { tsearch: { prefix: true } }

  ...
end