diff options
author | James Gifford <james@jamesrgifford.com> | 2011-09-12 10:30:45 -0400 |
---|---|---|
committer | James Gifford <james@jamesrgifford.com> | 2011-09-12 10:30:45 -0400 |
commit | d7154d483269fc25d771d5b8b7b8a2c889e4b3f5 (patch) | |
tree | 903afe48e0393578c54b42d050a85f8770e93121 /railties/guides/code/getting_started/app/controllers/comments_controller.rb | |
parent | 4bcacc80667a548664b5ca09d85074c6c383748e (diff) | |
download | rails-d7154d483269fc25d771d5b8b7b8a2c889e4b3f5.tar.gz rails-d7154d483269fc25d771d5b8b7b8a2c889e4b3f5.tar.bz2 rails-d7154d483269fc25d771d5b8b7b8a2c889e4b3f5.zip |
Added getting_started code, updated guide with link to rails github repo and path to code
Diffstat (limited to 'railties/guides/code/getting_started/app/controllers/comments_controller.rb')
-rw-r--r-- | railties/guides/code/getting_started/app/controllers/comments_controller.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/railties/guides/code/getting_started/app/controllers/comments_controller.rb b/railties/guides/code/getting_started/app/controllers/comments_controller.rb new file mode 100644 index 0000000000..7447fd078b --- /dev/null +++ b/railties/guides/code/getting_started/app/controllers/comments_controller.rb @@ -0,0 +1,16 @@ +class CommentsController < ApplicationController + http_basic_authenticate_with :name => "dhh", :password => "secret", :only => :destroy + def create + @post = Post.find(params[:post_id]) + @comment = @post.comments.create(params[:comment]) + redirect_to post_path(@post) + end + + def destroy + @post = Post.find(params[:post_id]) + @comment = @post.comments.find(params[:id]) + @comment.destroy + redirect_to post_path(@post) + end + +end |