diff options
Diffstat (limited to 'guides/code/getting_started/app/controllers/posts_controller.rb')
-rw-r--r-- | guides/code/getting_started/app/controllers/posts_controller.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/guides/code/getting_started/app/controllers/posts_controller.rb b/guides/code/getting_started/app/controllers/posts_controller.rb index e4d83dd279..2ad69a9bcf 100644 --- a/guides/code/getting_started/app/controllers/posts_controller.rb +++ b/guides/code/getting_started/app/controllers/posts_controller.rb @@ -14,7 +14,10 @@ class PostsController < ApplicationController def create @post = Post.new(params[:post]) - @post.save - redirect_to :action => :show, :id => @post.id + if @post.save + redirect_to :action => :show, :id => @post.id + else + render 'new' + end end end |