我是 Rails 和 MVC 开发的初学者,需要以下帮助:
我正在做http://edgeguides.rubyonrails.org/getting_started.html中的示例
在“5.12 更新帖子”中,我们被要求将以下内容添加到我们的 config/routes.rb 中:
patch "posts/:id" => "posts#update"
如果我这样做并运行rake routes
,我会收到以下错误:
undefined method `patch' for #<ActionDispatch::Routing::Mapper:0x390f078>
我去时遇到同样的错误 -http://localhost:3000/posts/1
这是 edit.html.erb 中的行:
<%= form_for :post, url: { action: :update, id: @post.id }, method: :patch do |f| %>
我有 Rails 3.2.1。
环境:
我在 Windows 7 中执行此操作。我通过 railsinstaller.org 安装了 Rails。浏览器 - Chrome、Firefox