def create
  @comment = Comment.new(params[:comment])
  @comment.user = User.find(session[:user_id])
  @comment.post = @post
  
  respond_to do |format|
    if @comment.duplicate? or @post.comments << @comment
      format.js do
        render :update do |page|
          page.replace_html "comments_for_post_#{@post.id}",
                            :partial => "comments/comment",
                            :collection => @post.comments
          page.show "add_comment_link_for_post_#{@post.id}"
          page.hide "new_comment_form_for_post_#{@post.id}"
        end
      end
    else
      format.js { render :nothing => true }
    end
  end
end

