修改 app/controllers/posts_controller.rb 12345678 - before_action :authenticate_user!, only: [:new, :create]+ before_action :authenticate_user!, only: [:new, :create, :destroy]+ def + @post = Post.find(params[:id])+ @post.destroy+ redirect_to account_posts_path, alert: "Post deleted"+ end 成果 Reference Rails 101 (Rails 5版) 額外作業 赞微海报分享
近期评论