Ask A Question

Notifications

You’re not receiving notifications from this thread.

Very strange Rails app behaviour

John asked in Rails

I've been writing a meal planning app, using Devise for user auth. I've generated the viexws,,,,,,,,,, set config.scoped_views to true, made sure routes.rb has devise_for :users, and setup my before_action. When I visit app root not signed in,,,,,, I'm taken to a non-devise sign-in page that doesn't work yet the url in address bar is users/sign_in. If I refresh, Devise page loads and I can login.

If I create or edit a recipe, and it's successful, I'm taken to recipe detail page as expected,,,,,,,,, but page is blank. Refresh, and data comes back.

Login/Logout buttons point to Devise(yes, I've tripple checked) yet only load Devise forms some of the time. The rest of the time,this non-Deviseform that Ican't find afile for for the life of me loads.

Anyone haveideas what wouldcause this?

Reply

Do you have a service worker stuck on your localhost? Try in another browser and see if you have the same issue.

Reply

I struggle to understand the real problem. but if login/logout doesnt work, either is the routes file or the rails ujs, in order to send a HTTP DELETE request, by clicking in a link, rails UJS needs to be running.

Reply

Problem located, and resolved. The problem seems to have been 2 fold....first off, I didn't have a users controller....creating an empty one fixed the login/logout/signup behavior. Now I can even edit user. Secondly, I had cchangedall the link_tos to button_tos forgetting that by default button_to uses POST rather than GET. This caused all sorts of havock, and was fixed by adding method: :get toallthe button_to statements.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.