Missing Template Error

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

Edit Post

<%= form_for @post do |f| %>

<%= f.label :title %>
<%= f.text_field :title %>

<%= f.label :body %>
<%= f.text_area :body %>

<%= f.select :category_id, Category.all.collect {|x| [x.name, x.id]}, {:include_blank => "Select One"} %>

<%= f.submit "Update Post" %>

<% 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

On Wed, May 25, 2016 at 7:40 AM, Aditya T. wrote:

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

Missing template posts/update, application/update

POST_CONTROLLER.RB

class PostsController < ApplicationController

def update

end

Once you have typical code in the controller to handle updates, you’ll
no longer have this problem. A typical update action redirects to
show on success, and renders the edit template on failure. Either
one, though, is explicit. As several posters here regularly say, I
recommend you work your way straight through a good tutorial, such as
https://www.railstutorial.org/.

-Dave


Dave A., consulting software developer of Codosaur.us,
PullRequestRoulette.com, Blog.Codosaur.us, and Dare2XL.com.

your update action is blank. You have to render something or redirect to
some other page. I mean it has to have some response.

On Wed, May 25, 2016 at 5:20 PM, Dave A. <

@praveen_k95

thank you for replying.
i know, the update action is blank. but i am trying to edit this post
already made. therefore i am working through edit only.
actually i am trying to follow this tutorial and he is using 1.9.3
version of ROR, and i am working on 4, and thats creating alot of
issues.

On May 25, 2016, at 7:59 AM, Aditya T. [email protected] wrote:

@praveen_k95

thank you for replying.
i know, the update action is blank. but i am trying to edit this post
already made. therefore i am working through edit only.
actually i am trying to follow this tutorial and he is using 1.9.3
version of ROR, and i am working on 4, and thats creating alot of
issues.

Wow. Really find a newer tutorial. You are going to have such a
translation problem between then and now that you are only going to hurt
yourself. The only reason to mess with that version of Rails is if
someone dumps a lot of money on you to upgrade it (rewrite it, at that
distance) to current. The http://railstutorial.org is free to use on
line and one of the best-written tutorials on any subject I have ever
seen. It covers Rails 4.2, which is the current (soon to be less so with
5 coming out). I can’t find a reference to Rails 1.9.3 (maybe you mean
Ruby?), but if that’s really the version, that’s from 2007 or so. A lot
has changed.

Walter

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs