Getting Started with Rails guide - getting errors in step 5.12 Using partials

After changing the edit and new forms to use the _form partial, I get this error on trying to edit a record (I changed article to artwork for the examples):

No route matches [POST] “/artworks/2/edit” Rails.root: c:/Users/bburns/Desktop/arttour Application Trace | Framework Trace | Full Trace Routes Routes match in priority from top to bottom Helper HTTP Verb Path Controller#Action Path / Url
welcome_index_path GET /welcome/index(.:format) welcome#index artworks_path GET /artworks(.:format) artworks#index POST /artworks(.:format) artworks#create new_artwork_path GET /artworks/new(.:format) artworks#new edit_artwork_path GET /artworks/:id/edit(.:format) artworks#edit artwork_path GET /artworks/:id(.:format) artworks#show PATCH /artworks/:id(.:format) artworks#update PUT /artworks/:id(.:format) artworks#update DELETE /artworks/:id(.:format) artworks#destroy root_path GET / welcome#index Request Parameters: {“utf8”=>“?”, “authenticity_token”=>“0+8G5XLT4b6/3U1v6K4p0GnpcSxjsti8wid/+akAlDrFEQEfeVvnwp9Jte+ohyJGFUIw0vqYGnPcQxAP4rEijA==”, “artwork”=>{“artist”=>“inness”, “year”=>“1889”, “title”=>“moonrise”, “about”=>“”}, “commit”=>“Save Artwork”} And adding a new record gets a similar error -

No route matches [POST] "/artworks/new"

I’m new to Rails so not sure what might be going wrong - thanks in advance for any pointers

routes.rb:

Rails.application.routes.draw do get ‘welcome/index’ resources :artworks root ‘welcome#index’ end

artworks_controller.rb:

class ArtworksController < ApplicationController

def index @artworks = Artwork.all end

def show @artwork = Artwork.find(params[:id]) end

def new @artwork = Artwork.new end

def edit @artwork = Artwork.find(params[:id]) end

def create @artwork = Artwork.new(artwork_params) if @artwork.save redirect_to @artwork else render ‘new’ end end

def update @artwork = Artwork.find(params[:id])
if @artwork.update(artwork_params) redirect_to @artwork else render ‘edit’ end
end

private def artwork_params params.require(:artwork).permit(:artist, :title, :year, :about) end

end

edit.html.erb:

Editing artwork

<%= render 'form' %> <%= link_to 'Back', artworks_path %>

_form.html.erb:

I think that should be form_for @artwork

Hi I am also doing this tutorial but go stuck on 5.12 Using Partials. I kept getting a message saying that the template was missing, but it wasn’t. It kept looking for _form instead of _form.html.erb, not sure why. So to get it working I had to change the file to _form, this doesn’t seem correct. I have checked all the code and all is correct, to make sure I copied the code from the web page to eradicate any typos. I did carry on with the tutorial which I have know finished, but this is still bugging be for future refernce.