Autocomplete input field name


Hi All,

I’m new to ruby on rails and I struggle with a problem in my first
application. I searched the forum (and ofcourse google) but I think it
is just an easy thing that nobody boughters to write down :slight_smile:

I am building a kind of library application for (fysical) books and
e-books and later I want to add other functions like knowledge

The problem: in the book show page I have a form to add a author with
auto complete:


<%= text_field_with_auto_complete :author, :name %> ...

class BookController < ApplicationController
auto_complete_for :author, :name, :limit => 5

def addauthor
@book = Book.find(params[:bookid])
@author = Author.find_by_name(params[:authorname])
redirect_to :controller => ‘book’, :action => ‘show’, :id => @book

When I manually enter the right url with variabels (is it english?)
bookid and authorname it works, but when I use the form the name of the
autocomplete field is author[name] and the url it produces is:


So I get an error and I cannot say @author =

All help is welcome,

With kind regards,

Alexander Ketelaar


I already found it:

@author = Author.find_by_name(params[:author][:name])

Thanx anyway