app/controllers/form_creation/posts_controller.rb
# DELETE method for deleting a Post from database based on id   
DELETE method for deleting a Post from database based on id
DELETE method for deleting a Post from database based on id
def destroy   
      @post = Post.find(params[:id])   
      if @post.delete   
        flash[:notice] = 'Post deleted!'   
        redirect_to posts_path   
      else   
        flash[:error] = 'Failed to delete this Post!'   
        render :destroy   
      end   
    end
def destroy @post = Post . find ( params [ :id ] ) if @post . delete flash [ :notice ] = 'Post deleted!' redirect_to posts_path else flash [ :error ] = 'Failed to delete this Post!' render :destroy end end
DELETE method for deleting a Post from database based on id
DELETE method for deleting a Post from database based on id