I am using rails3-jquery-autocomplete plugin.
I would like to search by several attributes, for instance title and app_number.
What I tried:
in model:
class Eclaim < ActiveRecord::Base
scope :search_by_number, ->(query){
(query ? where(["app_number LIKE ?", '%'+ query + '%']) : {})
}
end
in controller:
class ClaimsController < ApplicationController
autocomplete :eclaim, :title, :extra_data => [:app_number], :scopes => [:search_by_number]
end
But when I am using auto complete field I get error:
ArgumentError (wrong number of arguments (0 for 1)):
app/models/eclaim.rb:16:in `block in <class:Eclaim>'
It looks like the plugin doesn't assing query variable.
Can Anyone help me?