lundi 22 juillet 2019

Redirect to the previous page(same page)with destroy method

I am creating a cancel order page where customers can click on the cancel button and the page will render "order canceled successfully" and stay on the cancel page with the button disabled. I've googled and searched through it still not too sure how to achieve that, please help thank you so much!

  def destroy

    order.cancel
    redirect_to order_path(order.shopify_id), notice: 'Order cancelled'


end

</div>
<%= link_to 'Cancel Here', order_path(@order.shopify_id), method: :delete, class: 'btn btn-danger ' %>


</div>


Aucun commentaire:

Enregistrer un commentaire