Repository is archived
No commit activity in last 3 years
No release in over 3 years
Wraps jQuery-Autocomplete in rails asset wrappers.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

jQuery Autocomplete Rails

Wraps the jQuery Autocomplete library in a rails engine so that it can be used by the asset pipeline. This gem includes the non-minified source code which the asset pipeline will minify in production. It also includes a default CSS.

Installation

Add the following to your gem file

gem 'jquery_autocomplete_rails'

Add the JS to your application.js or similar location

//= require jquery.autocomplete

Add the CSS to your application.css or create your own version

/*
 *= require jquery.autocomplete
 */

Usage

Html:

<input type="text" name="country" data-autocomplete="true"/>

Ajax lookup:

$('[data-autocomplete="true"]').autocomplete({
    serviceUrl: '/autocomplete/countries'
});

Local lookup (no ajax):

var countries = [
   { value: 'Andorra', data: 'AD' },
   // ...
   { value: 'Zimbabwe', data: 'ZZ' }
];

$('[data-autocomplete="true"]').autocomplete({
    lookup: countries
});

For a full list of options check the API.

Versioning

This gem's version will match the jQuery Autocomplete libraries version. If a gem specific update is needed then we will add a 4th number of the version to indicate that the update was in the gem.

  • gem 1.2.9 = library 1.2.9
  • gem 1.3.0 = libary 1.3.0
  • gem 1.3.0.1 = library 1.3.0 (but the gem needed to be updated)