Method: FormCreation::PostsController#destroy
- Defined in:
- app/controllers/form_creation/posts_controller.rb
#destroy ⇒ Object
DELETE method for deleting a Post from database based on id
56 57 58 59 60 61 62 63 64 65 |
# File 'app/controllers/form_creation/posts_controller.rb', line 56 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 |