Rescuing redirect :back after destroy in Rails? -


I am looking for one of the best practice solutions that might be able to use redirects: successful removal action After, many items can be removed from different types of lists.

Unfortunately, in one case the strategy fails, when the item begins to be removed after seeing it.

What approach do you recommend for this situation?

If an item has been removed from its view, then you have to consider what you want Page.

I suggest one of two options:

In view of your redirect: back , and on the requested resource Applying another type of redirection no longer exists - i.e. / products / 10 redirection to / products

  @product = Product. Find_by_id (paragraph Ms [: id]) # However, I believe that I do not know that redirect_to products_path will change about @product # about  

or redirect the redirect if the special path is destroyed One matches the

  @ product.destroy # You may have to save the path before the object is deleted. Redirect_to: back and return request.referrer == product_path (@product) Redirect_to products_path  

I do not think there is a set-in-stone standard for this kind of scenario, but I can stand properly Am.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -