diff options
Diffstat (limited to 'guides/code/getting_started/app/controllers')
-rw-r--r-- | guides/code/getting_started/app/controllers/posts_controller.rb | 14 |
1 files changed, 14 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 947cd2a767..fc71e9b4e8 100644 --- a/guides/code/getting_started/app/controllers/posts_controller.rb +++ b/guides/code/getting_started/app/controllers/posts_controller.rb @@ -21,4 +21,18 @@ class PostsController < ApplicationController render 'new' end end + + def edit + @post = Post.find(params[:id]) + end + + def update + @post = Post.find(params[:id]) + + if @post.update_attributes(params[:post]) + redirect_to :action => :show, :id => @post.id + else + render 'edit' + end + end end |