method

auto_complete_result

auto_complete_result(entries, field, phrase = nil)
public

Use this method in your view to generate a return for the AJAX autocomplete requests.

Example action:

  def auto_complete_for_item_title
    @items = Item.find(:all,
      :conditions => [ 'LOWER(description) LIKE ?',
      '%' + request.raw_post.downcase + '%' ])
    render :inline => '<%= auto_complete_result(@items, 'description') %>'
  end

The auto_complete_result can of course also be called from a view belonging to the auto_complete action if you need to decorate it further.