From 2e2afc0ac64190261df4b05428afddea96c8628c Mon Sep 17 00:00:00 2001 From: Oscar Del Ben Date: Fri, 20 Apr 2012 12:06:47 +0200 Subject: Add show action in getting started guide --- guides/code/getting_started/app/controllers/posts_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'guides/code/getting_started/app/controllers') 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 -- cgit v1.2.3