AutoComplete Plugin

The auto_complete plugin provides “live”, ajax based autocompletion for text input fields. Installation:

script/plugin install auto_complete

Usage (taken from README file in plugin):

  # Controller
  class BlogController < ApplicationController
    auto_complete_for :post, :title
  end

  # View
  <%= text_field_with_auto_complete :post, :title %>

Undocumented Features

Well, the features of the underlying scriptaculous javascript “class” are documented, right here on github.

To expand the previous example (from the README file), here's what you can do:

  # View
  <%= text_field_with_auto_complete :post, :title, {:size => 50}, {:min_chars => 3} %>

Put your html options (here, size) in the 3rd argument (a hash), and the options for the Ajax.Autocompleter in the 4th argument (also a hash). But do not use the camelized style: use underscores instead! Example: the original (javascript) option minChars becomes min_chars in your auto_complete helper.