我不知道我的应用程序发生了什么。我有一些控制器运行良好,但这个不是。
我的 sylabus_controller.rb
# encoding: utf-8
module Admin
class SylabusController < BaseController
def destroy
@sylabu = @topic.sylabus.find(params[:sylabus])
@sylabu.destroy
redirect_to admin_course_topic_sylabu_path(@course, @topic), notice: 'Sylabus deleted'
end
我的 /views/admin/sylabus/index.html.rb
<% @sylabu.each do |syla| %>
<tr>
<td><%= syla.mupet_code %></td>
<td><%= syla.name %></td>
<td style="width:155px">
<%= link_to '<i class="icon-pencil"></i>'.html_safe, edit_admin_course_topic_sylabus_path(@course,
@topic,
syla),
class: 'btn' %>
<%= link_to '<i class="icon-trash icon-white"></i>'.html_safe, [:admin, @course, @topic, syla], class: 'btn btn-danger', method: :delete, data: { confirm: 'Are you sure?' } %>
<%= link_to '<i class="icon-eye-open"></i>'.html_safe, [:admin, @course, @topic, syla],
class: 'btn' %>
</td>
</tr>
<% end %>
目标网站在按钮中删除是 localhost:3000/admin/courses/1/topics/2/sylabus.8 并带有以下错误消息
Routing Error
No route matches [DELETE] "/admin/courses/1/topics/2/sylabus.8"
Try running rake routes for more information on available routes.
如果我从控制台执行 rake 路由
POST /admin/courses/:course_id/topics/:topic_id/sylabus(.:format) admin/sylabus#create
new_admin_course_topic_sylabu GET /admin/courses/:course_id/topics/:topic_id/sylabus/new(.:format) admin/sylabus#new
edit_admin_course_topic_sylabu GET /admin/courses/:course_id/topics/:topic_id/sylabus/:id/edit(.:format) admin/sylabus#edit
admin_course_topic_sylabu GET /admin/courses/:course_id/topics/:topic_id/sylabus/:id(.:format) admin/sylabus#show
PUT /admin/courses/:course_id/topics/:topic_id/sylabus/:id(.:format) admin/sylabus#update
DELETE /admin/courses/:course_id/topics/:topic_id/sylabus/:id(.:format) admin/sylabus#destroy
真诚地,我不知道错误即将到来,因为它是来自其他运行良好的控制器的复制和粘贴。
非常感谢您的回答。
祝你有美好的一天