Skip to content

Instantly share code, notes, and snippets.

@guiceolin
Created February 17, 2010 23:59
Show Gist options
  • Save guiceolin/307156 to your computer and use it in GitHub Desktop.
Save guiceolin/307156 to your computer and use it in GitHub Desktop.
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