Problems with text_field_with_autocomplete

I’m trying to set up a search field with autocomplete. I have verified
that the server is called when I type a letter in the box, and that the
handler creates the correct instance variable. However, I never see the
partial that is supposed to be rendered.

Here are the relevant files. I included their paths/names in case I am
missing some nuance of the naming conventions.

Here’s the view: (app/views/topic/observer.rhtml)

<%= javascript_include_tag “prototype” %>
<%= javascript_include_tag “effects” %>
<%= javascript_include_tag “dragdrop” %>
<%= javascript_include_tag “controls” %>
<%= text_field_with_auto_complete :topic, :dr_title,
{}, :skip_style => true %>

Here’s the handler, it’s just faked up for now. I don’t care about the
actual search at this point, just want to show that the partial
rendering is not working:
file: app/controllers/topic_controller.rb:

def auto_complete_for_topic_dr_title
handle_autocompletion (params[:topic][:dr_title])
end

def tester
handle_autocompletion(params[:id])
end

private
def handle_autocompletion (value)
puts “VALUE = #{value}”
@results = []
thing = {“foo” => “bar”}
@results.push(thing)
render :partial => “matches”, :layout => false
end

Here’s the partial (app/views/topic/_matches.rhtml):

    nothing

If I hit http://localhost:3000/topic/tester/foo, I see the word
“nothing”. So I know the partial is rendered correctly in that case.

However, when I hit http://localhost:3000/topic/observer, I think that
I ought to see the word “nothing” no matter what I type into the box,
but I don’t see anything. I know the handler method is being called
because I see the puts output in the WEBrick console.

I have tried this in a few different browsers. I am running the most
recent version of rails as of a couple weeks ago (how do I tell which
exactly?). I also tried it on Ruby 1.8.2 and 1.8.3. And, I downloaded
the latest javascripts from script.aculo.us, none of these things made
any difference.

Hope someone can help…
DT

Dan T. wrote:

I’m trying to set up a search field with autocomplete. I have verified
that the server is called when I type a letter in the box, and that the
handler creates the correct instance variable. However, I never see the
partial that is supposed to be rendered.

Fyi, if anyone is curious about this, I fixed it by beginning with the
demo from script.aculo.us and changing things one step at a time instead
of trying to customize right off the bat.