Question: I'm using the Rails gem rails3-jquery-autocomplete to add categories to posts. 

I would like to restrict the search to include only categories that belong to the current user or post's author in the results.

The documentation says that I can specify a scope:

> 
> :scopes
> 
> 
> Added option to use scopes. Pass scopes in an array. e.g :scopes =>
>  [:scope1, :scope2]
> 
> 
> 

But I'm not sure how I would pass the user id here? 

It seems like a comon scenario, am I missing something obvious?

I found an answer that suggests modifying the `get_item` method, but that seems to break the auto-complete

[Scoping the results for rails3 jquery autocomplete plugin](https://stackoverflow.com/questions/4858816/scoping-the-results-for-rails3-jquery-autocomplete-plugin)

Answer: 
deb's answer works for me.
The code can be cleaned up a bit:

```
def get_autocomplete_items(parameters)
  super(parameters).where(:user_id => current_user.id)
end

```
There is small update to code for those who have having trouble with super method.because of dynamic dispatch it above code need to replaced as below:

```

def get_autocomplete_items(parameters)
 items = super(parameters)
 items = items.where(searchable: true)
end

```

to this:

```

def get_autocomplete_items(parameters)
 items = active_record_get_autocomplete_items(parameters)
 items = items.where(searchable: true)
end

```

Reference: <https://github.com/crowdint/rails3-jquery-autocomplete/issues/278>