0

我做一个link_to_remote但这是错误:未定义的方法link_to_remote错误的Rails

NoMethodError in Tasks#index 

Showing /Users/overallduka/youimports_app/app/views/tasks/index.html.erb where line #6 raised: 

undefined method `link_to_remote' for #<#<Class:0x1022c76f0>:0x10216ff00> 
Extracted source (around line #6): 

3: <div id="all_tasks"> 
4: <% @tasks.each do |task| %> 
5: &nbsp;<%= task.title %><br /> 
6: <p class="about_task"><%= link_to_remote task.status,"alert('aaa')" %> <%= task.about %></p> 
7: <% end %> 
8: </div> 

我不知道什么是错我让样品警示测试,但错误persistes,我不知道什么是错的我的看法是:

NoMethodError在任务#指数

显示/Users/overallduka/youimports_app/app/views/tasks/index.html.erb其中6号线提出:

ü ndefined方法`link_to_remote”为#<#:0x10216ff00> 提取的源(围绕线#6):

<% @tasks.each do |task| %> 
&nbsp;<%= task.title %><br /> 
<p class="about_task"><%= link_to_remote (status(task.status)),"alert('aaa')" %> <%= task.about %></p> 
<% end %> 
+0

'link_to_remote'do在Rails 3中不再存在 – Baldrick 2013-02-09 15:27:28

回答

1

link_to_remote和其他远程AJAX辅助已经在导轨3被去除并移动到宝石https://github.com/rails/prototype_legacy_helper。如果您只是在单击链接后尝试运行简单的js,请改为使用link_to_function而不是

link_to_function 'test_alert', 'alert("test")' 
相关问题