Forum: Ruby on Rails autocomplete input field name

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
D22d30d8a0145eda8c1d05f7646d549d?d=identicon&s=25 Alexander Ketelaar (alexanderk)
on 2006-02-13 14:37
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 :)

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:

  <form action="/book/addauthor" method="get">
  <%= text_field_with_auto_complete :author, :name %></p>
  <input name="bookid" value="<%= %>" type="hidden">

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
D22d30d8a0145eda8c1d05f7646d549d?d=identicon&s=25 Alexander Ketelaar (alexanderk)
on 2006-02-13 21:44
I already found it:

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

Thanx anyway
This topic is locked and can not be replied to.