Created
February 17, 2010 23:59
-
-
Save guiceolin/307156 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CommentsController < ApplicationController | |
# POST /comments | |
# POST /comments.xml | |
def create | |
@post = Post.find(params[:post_id]) | |
@comment = @post.comments.create(params[:comment]) | |
respond_to do |format| | |
format.html { redirect_to post_path(@post) } | |
format.js | |
end | |
end | |
# DELETE /comments/1 | |
# DELETE /comments/1.xml | |
def destroy | |
@comment = Comment.find(params[:id]) | |
@comment.destroy | |
respond_to do |format| | |
format.html { redirect_to(comments_url) } | |
format.xml { head :ok } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment