aboutsummaryrefslogtreecommitdiffstats
path: root/guides/code/getting_started/app/controllers
diff options
context:
space:
mode:
authorOscar Del Ben <info@oscardelben.com>2012-04-20 12:06:47 +0200
committerOscar Del Ben <info@oscardelben.com>2012-04-20 12:06:47 +0200
commit2e2afc0ac64190261df4b05428afddea96c8628c (patch)
treea94a70200a1ee434d3cfaa82e0040c6166d4692a /guides/code/getting_started/app/controllers
parentdbb4c4ddb601e06fef37f63d644a5297f3292c2a (diff)
downloadrails-2e2afc0ac64190261df4b05428afddea96c8628c.tar.gz
rails-2e2afc0ac64190261df4b05428afddea96c8628c.tar.bz2
rails-2e2afc0ac64190261df4b05428afddea96c8628c.zip
Add show action in getting started guide
Diffstat (limited to 'guides/code/getting_started/app/controllers')
-rw-r--r--guides/code/getting_started/app/controllers/posts_controller.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/guides/code/getting_started/app/controllers/posts_controller.rb b/guides/code/getting_started/app/controllers/posts_controller.rb
index 3373443b16..f9181f98c6 100644
--- a/guides/code/getting_started/app/controllers/posts_controller.rb
+++ b/guides/code/getting_started/app/controllers/posts_controller.rb
@@ -1,5 +1,10 @@
class PostsController < ApplicationController
+
+ def show
+ @post = Post.find(params[:id])
+ end
+
def new
end
@@ -7,6 +12,6 @@ class PostsController < ApplicationController
@post = Post.new(params[:post])
@post.save
- redirect_to :action => :index
+ redirect_to :action => :show, :id => @post.id
end
end