Installer le plugin : auto_complete
Générer la doc : rake doc:plugins:auto_complete
<%= javascript_include_tag :all %> <%= text_field_with_auto_complete :appellation, :name, {}, {:method => :get} %> ou suffisant : <%= text_field_with_auto_complete :appellation, :name %>
class AppellationController < ApplicationController auto_complete_for :appellation, :name #protect_from_forgery :only => [:create, :update, :destroy] protect_from_forgery :except => :auto_complete_for_appellation_name
def new @appellation = Appellation.new end
end
<%= text_field_with_auto_complete :message, :to, {},:url => {:action => :auto_complete_for_message_to, :id => session[:user].id}, :skip_style => true %>
http://www.xtended-blog.com/weblog/cascade_text_field_with_auto_complete/
|