0
可能重複:
error saying 「autocomplete method doesn't exist」 with rails3-autocomplete gemNoMethodError自動完成自動完成Rails3中寶石
我試圖用Rails3中,jQuery的自動完成的寶石來實現自動完成。 我收到一個錯誤說
NoMethodError (undefined method `autocomplete' for #<ReleasesController:0xb76febec>):
app/controllers/releases_controller.rb:41:in `new'
我安裝了寶石,我使用它在我的控制器
控制器代碼:
def new
autocomplete :users, :name
end
查看文件:
= autocomplete_field_tag 'tester_name', '', users_autocomplete_user_name_path, :size => 75
在給予捆綁安裝我能夠看到寶石:
[[email protected] trunk]# bundle install
Using rake (0.9.2)
Using abstract (1.0.0)
Using activesupport (3.0.10)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.10)
Using erubis (2.6.6)
Using rack (1.2.4)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.30)
Using actionpack (3.0.10)
Using mime-types (1.16)
Using polyglot (0.3.2)
Using treetop (1.4.10)
Using mail (2.2.19)
Using actionmailer (3.0.10)
Using arel (2.0.10)
Using activerecord (3.0.10)
Using activeresource (3.0.10)
Using bcrypt-ruby (2.1.4)
Using bundler (1.0.17)
Using cancan (1.6.7)
Using cocaine (0.2.0)
Using orm_adapter (0.0.5)
Using warden (1.0.6)
Using devise (1.4.2)
Using dynamic_form (1.1.4)
Using formtastic (1.2.4)
Using haml (3.1.3)
Using json (1.6.1)
Using rdoc (3.11)
Using thor (0.14.6)
Using railties (3.0.10)
Using jquery-rails (1.0.16)
Using paperclip (2.4.4)
Using pg (0.11.0)
Using rails (3.0.10)
Using rails3-jquery-autocomplete (1.0.5)
Using will_paginate (3.0.pre2)
請讓我知道如何糾正這個錯誤。
謝謝, Ramya。
感謝alony,通過給它之外的新我gettign以下錯誤「未定義的局部變量或方法'自動完成」對於#<#:0xb7099a7c>「 –
ramya
2011-12-30 12:04:57
這很奇怪,因爲在gem中定義了自動完成方法。你有沒有關注[本指南](https://github.com/crowdint/rails3-jquery-autocomplete)? – alony 2011-12-30 12:12:52
是的,我遵循指南。請讓我知道在這種情況下我應該在我的路線文件中添加什麼? – ramya 2011-12-30 13:53:50