Forum: Ruby on Rails How to view resource with Ajax.autocompleter

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.
1df9fc8ddf084661265bbae74a8d0b43?d=identicon&s=25 jko170 (Guest)
on 2007-02-23 23:03
(Received via mailing list)
I have ajax.autocompleter working and I can get the string entered
into the field from the list. But how do I view that selected text
with the 'show' method? Here is my code:

-----  Controller --------
def autocomplete
    search = params[:user]
    @users = User.find(:all,
       :conditions => [ 'LOWER(first_name) LIKE ? OR LOWER(last_name)
       LIKE ?',
       "%#{search.downcase}%", "%#{search.downcase}%" ],
       :order => 'first_name, last_name DESC',
       :limit => 8) unless search.blank?
    render :partial => "search"

------ autocompleter --------
<%= javascript_tag("new Ajax.Autocompleter('user',
                        {indicator: 'spinner',
                         frequency: 0,
                         minChars: 1,
                        );") -%>

------- search partial ----------
<ul class="autocomplete_list">
<% for user in @users do -%>
  <li class="autocomplete_item">
    <div class="name"><%= link_to user.whole_name, user_path(user) %></
<% end -%>

>From what I've read I think I need to use the updateAfterElement
option but I don't exactly know how. When the text is selected from
the list, I'd like it to invoke the 'show' medthod resulting in a url

Thanks for any help!
1df9fc8ddf084661265bbae74a8d0b43?d=identicon&s=25 jko170 (Guest)
on 2007-02-23 23:11
(Received via mailing list)
Oh, and I also have
method: 'get'
added to the autocompleter
This topic is locked and can not be replied to.