2010-12-16 5 views
10

내가 RJS에 새로운 해요, 난 모든 기본을 포함하고있어 this guide오류 : 정의되지 않은 방법 'link_to_remote'

에서 짧은 예를 따르는 application.html.erb에서 자바 스크립트 라이브러리

I 서버를 해고하고 페이지를 확인, 나는 오류가 있어요 : 더 link_to_remote이없는 것보다, 레일 3.xx를 사용하는 경우

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 'Add a fox', { :action => :add}, :remote => true

+0

T 귀하의 신속한 의존에 대한 귀하의 솔루션은 바로 ig 주셔서 감사합니다. 하지만 난 다른 오류가 발생했습니다. 경로가 일치하지 않습니다 {: action => "add", : controller => "videos"}, 공부할 수있는 간단한 레일 3.0 rjs 예제가 있다면 방황하고 있습니까? – mko

+3

와우, 레일스 문서는 _ 심각하게 오래되었습니다. http://guides.rubyonrails.org/ajax_on_rails.html#the-quintessential-ajax-rails-helper-link_to_remote는 여전히 "rails ajax"에서 최고의 Google 히트작입니다. – declan