2011-03-03 11 views
1

ウェブ上で検索した後、私は問題を抱えて:rails3でauto_completeを使うには?

私はrails3を使用して、私は、次のコマンド

rails plugin install git://github.com/patshaughnessy/auto_complete.git 

を行い、その後、私は私のレールサーバ

index.html.erbを再起動します。

<%= text_field_with_auto_complete :departement, :nom, {}, {:method => :get} %> 

マイコン:

class AutocompController < ApplicationController 
    auto_complete_for :departement, :nom 
end 

ように私は、モデルを得た:

Noルートマッチ{::コントローラ=>」私は次のエラーを取得する

resources :autocomp, :collection => { :auto_complete_for_departement_nom => :get } 

class CreateDepartements < ActiveRecord::Migration 
    def self.up 
    create_table :departements do |t| 
     t.column :region_id, :integer 
     t.column :num_dept, :string 
     t.column :nom, :string 
    end 
    end 

    def self.down 
    drop_table :departements 
    end 
end 

私のroutes.rbをautocomp "、:action =>" auto_complete_for_departement_nom "}

なぜ動作しないのですか? rails3とauto_complete互換ですか? jQueryを使うべきですか?

答えて

0

ルートを設定する必要があります。欠けているので、あなたはこのメッセージを受け取ります。

後藤のconfig/routes.rbをと同じように、あなたのルートを追加します、autocomplete

を使用して

resources : departements do 
    get : auto_complete_for_departement_nom, :on => :collection 
end 

イム

関連する問題