-
Notifications
You must be signed in to change notification settings - Fork 364
Open
Labels
Milestone
Description
I have a model called Airport, which has three columns, name, city, and country.
I want autocomplete to narrow down the possible outcomes by typing name followed by city and country. How can I do that?
If my understanding is correct, I need to override the function
def get_autocomplete_items(parameters)
super(parameters).where(:city => params[:city], :country => params[:country])
end
and add scopes
:scopes => [:city, :country]
in the form
<%= autocomplete_field_tag :departure_id, @departure_place,
autocomplete_airport_name_plans_path,
:size => 75, :scopes => [:city, :country], 'data-delimiter' => ' ' %>
But certainly it does not work. I am sure there must be a way.