aboutsummaryrefslogtreecommitdiffstats
path: root/guides/code/getting_started/app/controllers/posts_controller.rb
diff options
context:
space:
mode:
authorOscar Del Ben <info@oscardelben.com>2012-04-27 14:21:02 +0200
committerOscar Del Ben <info@oscardelben.com>2012-04-27 14:21:02 +0200
commitf4447607f20c420d9c341b19064c07d5b7aa6cee (patch)
treec389a5bb39707e5cf556cc7ca92690c77d8c143e /guides/code/getting_started/app/controllers/posts_controller.rb
parent8c1633328699cc00b1b8a893bffa6390c2cdfcc0 (diff)
downloadrails-f4447607f20c420d9c341b19064c07d5b7aa6cee.tar.gz
rails-f4447607f20c420d9c341b19064c07d5b7aa6cee.tar.bz2
rails-f4447607f20c420d9c341b19064c07d5b7aa6cee.zip
Add delete post section to Getting Started guide
Diffstat (limited to 'guides/code/getting_started/app/controllers/posts_controller.rb')
-rw-r--r--guides/code/getting_started/app/controllers/posts_controller.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/guides/code/getting_started/app/controllers/posts_controller.rb b/guides/code/getting_started/app/controllers/posts_controller.rb
index fc71e9b4e8..85d2c1de47 100644
--- a/guides/code/getting_started/app/controllers/posts_controller.rb
+++ b/guides/code/getting_started/app/controllers/posts_controller.rb
@@ -35,4 +35,11 @@ class PostsController < ApplicationController
render 'edit'
end
end
+
+ def destroy
+ @post = Post.find(params[:id])
+ @post.destroy
+
+ redirect_to :action => :index
+ end
end