Tag: http delete

没有路由匹配进行删除和更新

我知道很多次都会问这个问题,但到目前为止,没有一个食谱对我有所帮助。 我有一个用Ruby 2.0.0编写的应用程序,Rails 4.0.0以及以下routes.rb: resources :announcements do end 这会产生以下路线: announcements GET /announcements(.:format) announcements#index POST /announcements(.:format) announcements#create new_announcement GET /announcements/new(.:format) announcements#new edit_announcement GET /announcements/:id/edit(.:format) announcements#edit announcement GET /announcements/:id(.:format) announcements#show PATCH /announcements/:id(.:format) announcements#update PUT /announcements/:id(.:format) announcements#update DELETE /announcements/:id(.:format) announcements#destroy 然后在HTML中我使用非常简单的构造: 其中产生以下代码: 一切看起来都很简单,干净,正确。 不过我收到“No Route Matches”错误。 为什么?

从Sinatra发送DELETE请求

我正在尝试开发RESTful Sinatra应用程序。 现在,我知道如何用类似的方式响应删除请求 delete ‘/user/:id’ do |id| #do something in the model end 我感兴趣的是如何执行该方法。 我不能拥有DELETE而不是GET的链接,可以吗? 到目前为止我找到的唯一解决方案是通过jQuery发送DELETE请求: 如何在jQuery中发送PUT / DELETE请求? 我尝试在github上查看不同的RESTful Sinatra项目,但我的Ruby知识可能仅限于了解它们是如何做到的。