fetch data from textfield

     book=Book.find_by_book_id(params[:query])

Try it :

       @book=Book.find_by_book_id(params[:query])

By creating instance variable it will be accessible to your query field.