SimpleAutoComplete

The most simple gem for text field auto complete. You only have to specify what collection you want to use for autocompletion.

Installation

Add this line to your application's Gemfile:

gem 'simple_auto_complete'

And then execute:

$ bundle install

Add this line to application.js:

//= require simple_auto_complete

Add this line to application.css:

*= require simple_auto_complete

Usage

Example 1:

  #in controller:
  @days =  ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Satturday", "Sunday"]

  #in view:
  <%= text_field_tag_with_auto_complete :day, "", @days, id: "day_name" %>

Parameters are the same like text_field_tag has, but collection parameter (@days) that is put on third position

Example 2:

 <%= f.text_field_with_auto_complete :country, @countries, {} %>