app/controllers/articles_controller.rb
def require_same_user
      if current_user != @article.user
        flash[:notice] = "You can only edit or delete your own articles"
        redirect_to root_path
      end
    end
#Require same user before update or delete
Require same user before update or delete
Require same user before update or delete
def require_same_user
      if current_user != @article.user
        flash[:notice] = "You can only edit or delete your own articles"
        redirect_to root_path
      end
    end
def require_same_user if current_user != @article . user flash [ :notice ] = "You can only edit or delete your own articles" redirect_to root_path end end
Require same user before update or delete
Require same user before update or delete