codeforUV / food_resources

A project that aims to increase food access for residents of the Upper Valley region of VT/NH
https://food-resources.herokuapp.com
MIT License
1 stars 6 forks source link

Routing error when clicking "Sign out" #70

Closed siobhanjacobson closed 3 years ago

siobhanjacobson commented 3 years ago

Screenshot from 2021-02-04 21-50-43

bthooper commented 3 years ago

I am looking into this, however, initially, I can't reproduce it. Can you confirm this is still an issue?

thomascchen commented 3 years ago

I tested this locally with a fresh database reset (rails db:reset), and I got the same error.

bthooper commented 3 years ago

sorry...i needed to sync my fork with the main repo...so now i get the error...will work on fix now.

bthooper commented 3 years ago

OK...this one led me down some Devise rabbit holes.....

The issue is with the routes. There is no UserController because we use devise to handle the users and sessions. So, the route where we nest food_resources under users creates a bunch of users routes that we don't have a controller for.

But another issue is I can't seem to send "delete" requests to the server. This is true even if you are logged in and try to delete a food_resource. I'm not sure why I am unable to send delete requests, since the links have "method: :delete" in them and Rails seems to render them correctly....

However, if instead of a link_to I use a button_to...the delete request seems to work.....

So, I just thought I'd toss this in here and see if this is something anyone has come across or seen before or has any ideas about. Also wondering if this has something to do with javascript not being configured correctly on the rails server?

bthooper commented 3 years ago

I sent a pull request to fix this.....so it's under review at the moment!

bthooper commented 3 years ago

Just pinging this one...I think my pull request is still there...hopefully it is ok...was going to work on the form error messaging issue, but didn't want to dive into that with this routing issue still unresolved.

thomascchen commented 3 years ago

Hey @bthooper I left a comment on your PR over here: https://github.com/codeforUV/food_resources/pull/76#issuecomment-828835513

Looks like the comments on that linked issue mention some workarounds that I think would be worth trying out.

thomascchen commented 3 years ago

Closed by #76