2010-12-16 14 views
10

私はRJSに新たなんだ、私はすべてのデフォルトを含めていthis guideエラー:未定義のメソッド 'はlink_to_remote'

に短い例に従うapplication.html.erbでJavaScriptライブラリ

Iサーバーを起動し、ページをチェックし、私はエラーを得た:

Showing /Users/PowerBook/Desktop/makprojects/drummercymbal/app/views/videos/show.html.erb where line #9 raised: 

undefined method `link_to_remote' for #<#<Class:0x217f64>:0x213d74> 
Extracted source (around line #9): 

6: <li>Cat</li> 
7: <li>Mouse</li> 
8: </ul> 
9: <%= link_to_remote("Add a fox", :url => { :action => :add}) %> 

答えて

24

あなたは何link_to_remoteがないよりも、レール3.xxのを、使用している場合は、link_to 'Add a fox', { :action => :add}, :remote => true

+0

Tがありますあなたの迅速な頼みに感謝します。あなたの解決策は正しいです。しかし、私は他のエラーを持っていますルートは一致しません{:action => "add"、:controller => "videos"}、私は勉強させることができる単純なレール3.0 rjsの例があれば私はさまよっていますか? – mko

+3

うわー、Railsのドキュメントは_真実ではありません。 http://guides.rubyonrails.org/ajax_on_rails.html#the-quintessential-ajax-rails-helper-link_to_remoteはまだ「rails ajax」にとってGoogleのトップヒットです – declan

関連する問題