Skip to content

Instantly share code, notes, and snippets.

@dabit
Created February 26, 2012 21:17
Show Gist options
  • Save dabit/1919034 to your computer and use it in GitHub Desktop.
Save dabit/1919034 to your computer and use it in GitHub Desktop.
autocomplete example
# Controller
class PostsController < ApplicationController
before_filter :authenticate_user!, :except => [:show, :index]
autocomplete :tag, :name
end
# Routes:
resources :posts do
get :autocomplete_tag_name, :on => :collection
end
# Form
form_for @post do |f|
f.autocomplete_field :tag_name, autocomplete_tag_name_posts_path
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment