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"}
Rails.application.routes.draw do
 get 'welcome/index'
 resources :artworks
 root 'welcome#index'
end
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
<h1>Editing artwork</h1>_form.html.erb:
<%= render 'form' %>
<%= link_to 'Back', artworks_path %>
<%= form_for :artwork do |f| %>
Â
 <% if @artwork.errors.any? %>
   <div id="error_explanation">
     <h2>
       <%= pluralize(@artwork.errors.count, "error") %> prohibited
       this artwork from being saved:
     </h2>
     <ul>
       <% @artwork.errors.full_messages.each do |msg| %>
         <li><%= msg %></li>
       <% end %>
     </ul>
   </div>
 <% end %>
Â
 <p>
   <%= f.label :artist %><br>
   <%= f.text_field :artist %>
 </p>
Â
 <p>
   <%= f.label :year %><br>
   <%= f.text_field :year %>
 </p>
Â
 <p>
   <%= f.label :title %><br>
   <%= f.text_field :title %>
 </p>
Â
 <p>
   <%= f.label :about %><br>
   <%= f.text_area :about %>
 </p>
Â
 <p>
   <%= f.submit %>
 </p>
Â
<% end %>
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Documentation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-do...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-docs.
For more options, visit https://groups.google.com/d/optout.