I am beginner in Rails & MVC development, and need help with the below:
I am doing the example in http://edgeguides.rubyonrails.org/getting_started.html
In “5.12 Updating Posts”, we are asked to add the following to our config/routes.rb:
patch "posts/:id" => "posts#update"
If I do that, and run rake routes, I am getting the below error:
undefined method `patch' for #<ActionDispatch::Routing::Mapper:0x390f078>
I get the same error when I go to – http://localhost:3000/posts/1
This is the line in edit.html.erb :
<%= form_for :post, url: { action: :update, id: @post.id }, method: :patch do |f| %>
I have Rails 3.2.1.
Environment:
I am doing this in Windows 7. I installed Rails via railsinstaller.org. Browsers – Chrome, Firefox
patchis only available in Railsmasterbranch.Among other things, you need to point to the git repo in your
Gemfileto use edge rails on an already-existing project.For now you should just use
PUTinstead ofPATCH. Even when 4.0 comes out,PUTisn’t going anywhere.