method

auto_complete_result

Importance_1
v1.0.0 - Show latest stable - 0 notes - Class: ActionView::Helpers::JavaScriptMacrosHelper
  • 1.0.0 (0)
  • 1.1.6 (0)
  • 1.2.6 (6)
  • 2.0.3
  • 2.1.0
  • 2.2.1
  • 2.3.8
  • 3.0.0
  • 3.0.9
  • 3.1.0
  • 3.2.1
  • 3.2.8
  • 3.2.13
  • 4.0.2
  • 4.1.8
  • 4.2.1
  • 4.2.7
  • 4.2.9
  • 5.0.0.1
  • 5.1.7
  • 5.2.3
  • 6.0.0
  • 6.1.3.1
  • 6.1.7.7
  • 7.0.0
  • 7.1.3.2
  • 7.1.3.4
  • What's this?
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.