给 TeacherController 配置多个一个方法 deleteall def da Teacher.delete_all respond_to do |format| format.html { redirect_to teachers_url } format.json { head :no_content } end end
rountes.rb: match "teachers/da" => "teacher#da", :via => "delete"
erb:
<%= link_to 'deleteall', teachers_da_path , method: :delete ,date:{confirm: 'Are you sure?'} %>
报错了 Routing Error
uninitialized constant TeacherController Try running rake routes for more information on available routes.