Flowdock
method

auto_complete_result

Importance_2
Ruby on Rails latest stable (v4.0.2) - 0 notes - Class: ActionView::Helpers::JavaScriptMacrosHelper

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v1.2.6) is shown here.

auto_complete_result(entries, field, phrase = nil) public

DEPRECATION WARNING: This method will become a separate plugin when Rails 2.0 ships.

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.