错误:未定义的方法'link_to_remote'

mko*_*mko 10 ruby-on-rails

我是RJS的新手,我遵循本指南中的简短示例

我在application.html.erb中包含了所有默认的javascript库

当我启动服务器并检查页面时,我收到一个错误:

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}) %>
Run Code Online (Sandbox Code Playgroud)

tig*_*tig 25

如果使用的是轨道3.xx的,不是没有link_to_remote,有link_to 'Add a fox', { :action => :add}, :remote => true

  • 哇,Rails文档已经过时了.http://guides.rubyonrails.org/ajax_on_rails.html#the-quintessential-ajax-rails-helper-link_to_remote仍然是谷歌"rails ajax"的热门歌曲 (3认同)