i am getting the missing template error when i try to update my post.

Missing template posts/update, application/update with {:locale=>[:en],
:formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw,
:ruby, :coffee, :jbuilder]}. Searched in: *
"c:/Sites/myrubyblog/app/views"

EDIT.HTML.ERB

<h1>Edit Post</h1>


<%= form_for @post do |f| %>
   <p>
     <%= f.label :title %><br />
     <%= f.text_field :title %><br />
   </p>
   <p>
     <%= f.label :body %><br />
     <%= f.text_area :body %><br />
   </p>
   <p>
     <%= f.select :category_id, Category.all.collect {|x| [x.name,
x.id]}, {:include_blank => "Select One"} %><br />
   </p>
   <p>
     <%= f.submit "Update Post" %><br />
   </p>

<% end %>
<% link_to "Go Back",post_path %>
--------------------------------------------------------------

POST_CONTROLLER.RB

class PostsController < ApplicationController
   def index
     @posts = Post.all
   end

   def show
     @post = Post.find(params[:id])
   end

   def new
     @post = Post.new
     @category = Category.all
   end

   def create
     @post = Post.new(post_params)
     if @post.save
       redirect_to posts_path, :notice => "Your post has been saved"
     else
       render "new"
     end
   end

   def post_params

   params.require(:post).permit(:category_id, :title, :body)

   end

   def edit
     @post = Post.find(params[:id])
   end

   def update

   end

   def destroy

   end

end

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ce4ee861c004fc3d0d07e866d3cfe12e%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 5 | next ›
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedMay 25, '16 at 11:41a
activeMay 27, '16 at 12:12p
posts5
users4
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase