简体   繁体   中英

Redirect_to with post params

I write this redirection :

redirect_to list_order_submit_path(:provider_id => @cart_item.product.provider.id)

But this show the Provider_id in URL:

localhost:3000/order/list?provider_id=1

How can i pass the variable not in URL or how I make this get to a post param ?

I'll quote the beginning of this SO answer for later viewers:

You can't do a redirect and send POST data at the same time in the HTTP spec.

You shouldn't do it. What you want is a GET petition because you are listing elements and not modifying them.

So passing the argument in the header is correct and the best practice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM