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/.