Skip to content
This repository has been archived by the owner on Oct 11, 2019. It is now read-only.

How to deal with RecordNotFound? #86

Open
amnesia7 opened this issue Sep 5, 2014 · 0 comments
Open

How to deal with RecordNotFound? #86

amnesia7 opened this issue Sep 5, 2014 · 0 comments

Comments

@amnesia7
Copy link

amnesia7 commented Sep 5, 2014

If a product in the catalog is not found (ie its listed and then after the page has loaded for the user the product gets removed for whatever reason) I redirect the user to the root_path using redirect_to root_path but since my homepage isn't a wiselinks-enabled it goes a bit wrong when I try to aply wiselinks to this process because it tries to load the root_path html in my #product_list container.

I've seen #57 and tried using the following:

if request.wiselinks?
  render js: "<script>window.location.href = '#{root_path}'</script>"
else
  redirect_to root_path
end

but this just makes a large chunk of the page disappear (that would normally be replaced by wiselinks with the next page's content)...and then it redirects the browser to the root_path.

Is there a way to make wiselinks not remove the content before doing the redirect?

Alternatively, is there a way to leave the page content alone and just show my flash message ("Product not found")?

Is there a better/another way to deal with RecordNotFound?

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant