0

I set up a Ruby on Rails simple Devise Authentication on my website. Then I added in Jquery to make it look nicer but whenever I sign in or out the URL at the top doesn't update but the rest of the page does. It still says "http://localhost:3000/users/sign_in" when I click the refresh button it then says "http://localhost:3000/dashboard" like it's supposed to.

my routes.rb file is simple:

Devise::Application.routes.draw do
  devise_for :users
  resources :dashboard
  root to: "home#index"
  get "sign_in" => "users#sign_in"
end

Like I said this also happens when I click sign out from the dashboard. it redirects to home#index but the URL doesn't say home/index or / it says /users/sign_out/

I thought this might have started happening after I set up Jquery I didn't notice it before, so I'm not sure.

Last thing, when I sign in and I see my dashboard then I click on the sign out button, there is a jquery popup that flashes across the screen and says "error on page" so I have to refresh so the URL is correct then I can click links and it behaves correctly.

It's as if half of the program thinks I'm signed in and the other half doesn't realize it yet.

any thoughts?

MetaStack
  • 3,266
  • 4
  • 30
  • 67
  • yes, should they be off? if so, how do I not use them? do I turn them off by just removing these two lines from the application.index.erb? `<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> <%= javascript_include_tag "application", "data-turbolinks-track" => true %>` I have to admit I don't know what turbolinks do. – MetaStack Dec 21 '13 at 18:39
  • Turbolinks basically refreshed the body of the page with Ajax, and leaves the headers intact. This could be the problem you're seeing. To turn them off, just take out the `data-turbolinks`references from your javascript calls! – Richard Peck Dec 21 '13 at 18:45
  • Thanks! I'll do that tomorrow and let you know how it goes. – MetaStack Dec 21 '13 at 19:10
  • unfortunately that didn't do the trick. looking through my code I saw no `data-turbolinks` referenced. when I removed `//= require turbolinks` my application was unaffected and when I removed the `stylesheet_link_tag` and `javascript_inclue_tag` listed above it removed my jquery look, and also didn't have an effect on the linking problem. when I just deleted `, "data-turbolinks-track" => true` from the javascript tag it had no affect on the website whatsoever. – MetaStack Dec 24 '13 at 18:00
  • Perhaps I need to look at the sessions controller that devise created for me. – MetaStack Dec 24 '13 at 18:21
  • 1
    in the cmd it says "can't verify csrf token authenticity" so I looked that up and found http://stackoverflow.com/questions/7203304/warning-cant-verify-csrf-token-authenticity-rails. I don't know if this would fix it but it might be the issue. – MetaStack Dec 29 '13 at 10:40

0 Answers0