method
auto_complete_result
rails latest stable - Class:
ActionView::Helpers::JavaScriptMacrosHelper
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.