diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2012-04-25 18:33:36 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2012-04-25 18:33:36 +0530 |
commit | 4a3ce153f1e05c9c590e9ee74e818649336d929f (patch) | |
tree | 8552fc2e59d0217c43dba6cb376b111799ac2fa3 /guides/code/getting_started/app/controllers | |
parent | bb0906e2d7c283bccae3d903e9b19a83ca297811 (diff) | |
parent | 8189536aeb91394ccc649b9c14f0cf15c25b9423 (diff) | |
download | rails-4a3ce153f1e05c9c590e9ee74e818649336d929f.tar.gz rails-4a3ce153f1e05c9c590e9ee74e818649336d929f.tar.bz2 rails-4a3ce153f1e05c9c590e9ee74e818649336d929f.zip |
Merge branch 'master' of github.com:lifo/docrails
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 |