Using Rails 3.1.1. & 'rails3-jquery-autocomplete'
I think this question should be quite simple for anyone using the rails3-jquery-autocomplete gem but I can't find any info on it on www. I have a very straightforward setup of the rails3-jquery-autocomplete and it is working fine.
Using:
<%= f.autocomplete_field :query, autocomplete_search_result_query_search_results_path %>
where query is a column in my search_result table.
The search_results table also have a status_id-column where 1 = OK and 2 = NOT OK.
Thus, I want :query to be filtered so that only queries where status_id = 1 is fetched. How can I do that? As it is now all queries are fetched.
Putting it simple I want ":query" to equal select query where status_id = 1
.
Controller:
autocomplete :search_result, :query, :full => true
Routes:
resources :search_results, :only => [:index, :show, :new, :create], :path => 'sokresultat' do
get :autocomplete_search_result_query, :on => :collection
end