Sha256: a62b38a9c1f9a41f4e3e5a3b4844bf873e4de0bc7a03468be34b20a55a87b073

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

[![Build Status](https://travis-ci.org/rayasocialmedia/rails_autocomplete.png?branch=master)](https://travis-ci.org/rayasocialmedia/rails_autocomplete)

# RailsAutocomplete

A hassle-free autocomplete for Rails 3.2 using Twitter bootstrap.

## Installation

Add this line to your application's Gemfile:

    gem 'rails_autocomplete'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install rails_autocomplete

Then you need to add the following line to your application.js:

    //= require rails_autocomplete

## Usage

Assuming you have a Post model where you want to autocomplete posts based on their title field:


Add the following to app/views/posts/_form.html.erb:

    <%= f.autocomplete_field :post, autocomplete_posts_path %>

app/controllers/posts_controller.rb:

    def autocomplete
      @posts = Post.autocomplete(:name, params[:q])
      respond_to do |format|
        format.json { render json: @posts }
      end
    end

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_autocomplete-0.0.5 README.md