Created
February 26, 2012 21:17
-
-
Save dabit/1919034 to your computer and use it in GitHub Desktop.
autocomplete example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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