diff options
author | Oscar Del Ben <info@oscardelben.com> | 2012-04-21 12:01:33 +0200 |
---|---|---|
committer | Oscar Del Ben <info@oscardelben.com> | 2012-04-21 12:01:33 +0200 |
commit | 504ba12e8cd256b08a43f8ee56c6e2b0272ce6cc (patch) | |
tree | fc393654a317b5030d84e72ed04eb10acb8a35a7 /guides/code/getting_started/app/controllers | |
parent | d717468888b9695aaaafd1d79f125023f7810401 (diff) | |
download | rails-504ba12e8cd256b08a43f8ee56c6e2b0272ce6cc.tar.gz rails-504ba12e8cd256b08a43f8ee56c6e2b0272ce6cc.tar.bz2 rails-504ba12e8cd256b08a43f8ee56c6e2b0272ce6cc.zip |
Add model validation section to Getting Started guide
Diffstat (limited to 'guides/code/getting_started/app/controllers')
-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 |