Rails 部分错误 - 未找到路线

发布于 2024-11-05 21:30:29 字数 1158 浏览 0 评论 0原文

当我在没有 AJAX 的情况下渲染此部分时,它工作正常,但是当我使用 AJAX 调用渲染它时,我得到以下异常。

我做错了什么?

ActionView::Template::Error (No route matches {:action=>"destroy", :followerid=>1,     :follower_type=>"topic", :controller=>"follows", :discussion_id=>91}):
2: <% discussion.followers.each do |topic| %>
3:     <% if topic.is_a? Topic%>
4:           <h3><%= render :partial => '/shared/topic_item', :locals => { :topic => topic }%></h3>
5:           <%= button_to("unTag", discussion_follow_path(discussion.id, :follower_type => "topic", :followerid => topic.id ), :method => :delete, :remote =>true) %>
6:     <%end%>
7: <%end%>

app/views/discussions/_edit_topics.html.erb:5:in _app_views_discussions__edit_topics_html_erb__847854145_2171200660_7386124' app/views/discussions/_edit_topics.html.erb:2:ineach' app/views/discussions/_edit_topics.html.erb:2:in _app_views_discussions__edit_topics_html_erb__847854145_2171200660_7386124' app/views/follows/create.js.erb:9:in_app_views_follows_create_js_erb__1164388053_2171521760_0'

When I render this partial without AJAX it works fine but when I render it using AJAX call i get the following exception.

What am I doing wrong ?

ActionView::Template::Error (No route matches {:action=>"destroy", :followerid=>1,     :follower_type=>"topic", :controller=>"follows", :discussion_id=>91}):
2: <% discussion.followers.each do |topic| %>
3:     <% if topic.is_a? Topic%>
4:           <h3><%= render :partial => '/shared/topic_item', :locals => { :topic => topic }%></h3>
5:           <%= button_to("unTag", discussion_follow_path(discussion.id, :follower_type => "topic", :followerid => topic.id ), :method => :delete, :remote =>true) %>
6:     <%end%>
7: <%end%>

app/views/discussions/_edit_topics.html.erb:5:in _app_views_discussions__edit_topics_html_erb__847854145_2171200660_7386124'
app/views/discussions/_edit_topics.html.erb:2:in
each'
app/views/discussions/_edit_topics.html.erb:2:in _app_views_discussions__edit_topics_html_erb__847854145_2171200660_7386124'
app/views/follows/create.js.erb:9:in
_app_views_follows_create_js_erb__1164388053_2171521760_0'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文