Text_field_with_auto_complete problem

I have some difficulties with text_field_with_auto_complete. I’m new to
this, it just will not work, I must be doing something wrong. It would
be great if someone could advise me. I have tried to follow advice
available on the internet, so I don’t know what the problem is. The
script gets as far as the breakpoint in the controller, but it doesn’t
like the next line – giving the error message “undefined method or local
variable search”. This is what I have…

I have downloaded the .js files from aculo and followed their
instructions. I have put the .js files in a folder called “Javascripts”
in the root of my application.

My table is called institutions and the field is called name

I have added the following to the head of my layout:

<%= javascript_include_tag :defaults %>

My view is called place and is the following:

<%= text_field_with_auto_complete :institution, :names, { :size => 15 }, :skip_style => true -%>

In the controller I have:

def place

def auto_complete_for_institution_names
search = params[:institution][:names]
@institutions = Institution.search(search) unless search.blank?
render :partial => “live/search”

Then I have a partial called “_live.rhtml”, which contains:

    <% for institution in @institutions.to_a -%>
  • <%= institution_link institution.name, institution %>
  • <% end -%>


I still haven’t managed to resolve this issue, is this in some way
related to the rails helpers or something???


i just did this too. (Rails version 1.1.6)
i used the advance version
http://demo.script.aculo.us/ajax/autocompleter_customized (basic
i have an item that i want to associate to a project.

in the head of my layout I only call
<%= javascript_include_tag :defaults %>
I did not create a javascript folder


<%= start_form_tag :action => ‘associate_to_a_project’, :id => @item %>
<%= text_field_with_auto_complete :item, :project_id, {} %>

<%= submit_tag 'add' %>

<%= end_form_tag %>


def associate_to_a_project
@item = Item.find(params[:id])
@item.project =
if @item.update_attributes(params[:item])
flash[:notice] = ‘Project was successfully associated to item.’
redirect_to :action => ‘list’
render :action => ‘new’

def auto_complete_for_item_project_id
auto_complete_responder_for_projects params[:item][:project_id]

def auto_complete_responder_for_projects(value)
@projects = Project.find(:all,
:conditions => [ ‘LOWER(name) LIKE ?’,
‘%’ + value.downcase + ‘%’ ],
:order => ‘name ASC’)
render :partial => ‘projects’

view _projects

    <% for project in @projects do -%>
  • <%=h project.name %>
  • <% end -%>

and it worked. It did take me sometime to get scriptolicious’
instructions to work for my app but it was just figuring out what
variable to change/pass


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs