[英]Undefined method link_to_remote error Rails
我做了一個link_to_remote,但這是錯誤:
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: <%= task.title %><br />
6: <p class="about_task"><%= link_to_remote task.status,"alert('aaa')" %> <%= task.about %></p>
7: <% end %>
8: </div>
我不知道出什么問題了,我制作了一個示例警報進行測試,但錯誤仍然存在,我不知道我認為有什么問題是:
Tasks#index中的NoMethodError
顯示/Users/overallduka/youimports_app/app/views/tasks/index.html.erb,其中第6行出現:
#<#:0x10216ff00>的未定義方法`link_to_remote'(提取的源代碼)(在第6行附近):
<% @tasks.each do |task| %>
<%= task.title %><br />
<p class="about_task"><%= link_to_remote (status(task.status)),"alert('aaa')" %> <%= task.about %></p>
<% end %>
link_to_remote
和其他遠程ajax幫助器已在rails 3中刪除,並移至了gem https://github.com/rails/prototype_legacy_helper
。 如果僅在單擊鏈接后嘗試運行簡單的js,請改用link_to_function
link_to_function 'test_alert', 'alert("test")'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.