class PostsController < ApplicationController
def create
if @post.save(post_params)
redirect_to @post
else
render :new
end
end
end
class PostsController < ApplicationController
def create
if @post.save(post_params)
redirect_to @post
else
render :new, status: :unprocessable_entity
end
end
end
# POST /posts
def create
@post = Post.new(post_params)
if @post.save
redirect_to @post, notice: 'Post was successfully created.'
else
render :new
end
end