Question: Jquery UI autocomplete opens when you typed a letter in the input text area that matches a list of selections of the source object and close after making a selection from the list of selections using the enter key or close if the text you typed in is not in the list of selections.

How do I check when the autocomplete closed after typing text that is not in the list of selections? What I'm trying to do is when the enter key is enter, check if the autocomplete is closed, and if so, get the text in the text area if its not empty.

Something like this:

```
           $(".inputText").keydown(function()
           {
               if(keyChar == enterKey)
               {
                 // Somehow check is autocomplete is closed and if inputText is not empty, get the text without it interfering with the autocomplete select event. 
               }

           });

```

Answer: 
You can use [delete](http://www.ruby-doc.org/core-1.9.3/Hash.html#method-i-delete) method 

```
@members = params[:project].delete(:members)
@project = Project.new(params[:project])

```
You can do something like :

```
 before_filter :edit_params_hash, :only => [:create]

 def edit_params_hash
      @members = params[:projects][:members] if params[:projects][:members].present?
      params[:projects][:members] ||= nil
 end

```

and then in create use

```
def create
     @project = Project.new(params[:project])
     @project.save
     @project.members = @members
end

```

:)