Flowdock
method

auto_complete_result

Importance_1
v1.1.6 - Show latest stable - 0 notes - Class: ActionView::Helpers::JavaScriptMacrosHelper
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.

Show source
Register or log in to add new notes.