When using Turbolinks, signing out in a separate browser tab may become necessary for a

My Rails 4 application has two layouts; one for users who are logged out and another for those who are logged in. These layouts utilize different stylesheets.

The issue arises when I have multiple browser tabs open and log out of one tab. The other tab still displays the "logged in" layout, causing a mismatch between the displayed layout and the user's actual authentication status.

When I interact with the page on the tab that is supposed to be logged out, it redirects to the sign-in layout using Turbolinks, but fails to load the appropriate stylesheets for that layout.

Is there a way to instruct Turbolinks to reload the entire page along with the necessary stylesheets from the server side?

Thank you for any assistance provided.

Answer №1

When transitioning to Turbolinks 3, it appears that within your redirect_to method, you have the option to include turbolinks: false for a complete refresh. If you prefer sticking with the older version, you can also disable Turbolinks by setting

config.turbolinks.auto_include = false
in your application.rb file. Then, for controllers utilizing Turbolinks, simply add include Turbolinks::Controller to enable turbolinks.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Creating a horizontal navigation bar using localscroll.js in your website is a great way

In my portfolio, I want to create a horizontal navigation with local scroll to showcase a gallery of various pictures. For this, I have a (div id="projects") with links structured like this: <div id="projects"> <ul id="content-slider-inside ...

Utilize the HTML webpack plugin to include the rendered file within the router

Hey there! I'm currently dealing with a frustrating issue. I can't seem to locate the index.html file generated by html-webpack-plugin for rendering. Even though I can access it at localhost:8080/index.html, I'm struggling to figure out how ...

Data is not being refreshed by Ajax

In my forum, users are only allowed to edit and delete their own comments. I have set up an "edit" button that opens a modal when clicked, giving the user access to the data they submitted before. I've written an ajax function to target these fields a ...

Finally, $.getJSON has been triggered

When I click on an element, I want to open a bootstrap modal. The modal contains values retrieved from an ajax call using getJSON. However, the issue is that the getJSON function is only called after the jQuery function has finished executing. Below is my ...

Creating a Vue application without the use of vue-cli and instead running it on an express

Vue has an interesting feature where vue-cli is not necessary for running it without a server. Initially, I thought otherwise. The Vue installation page at https://v2.vuejs.org/v2/guide/installation.html mentions using a script under CDN. <script src=&q ...

Progressing in a connected sequence of changes on a linear graph with distinct points and a pause

A jsfiddle has been created here. Looking to move a circle along a sine wave graph, triggered by a click event. The circle should stop at specific x and y value pairs on the graph before moving to the last point and looping back to the first (ideally unti ...

Having trouble updating the URL path with the $location service in Angular

I'm facing a challenge in updating the URL path using the $location.url service, as it's not reflecting the changes correctly. For instance, my current URL path is http://localhost:64621/module/commercial/#/company/98163780-4fa6-426f-8753-e05a6 ...

When the drop-down selection changes in AngularJS, the textbox value becomes empty

When the user selects "text-box-value-empty", the textbox should be disabled and cleared. I have attempted to accomplish this using the code below, but unfortunately, it is not working as expected. If the user enters a value and then selects "text-box-valu ...

Error in NodeJs: Port 3000 is already in use due to the utilization of socket.io and express

I've developed a node.js application using socket.io and express. The code snippet is as follows: const express=require('express'); const app=express(); const http=require('http').Server(app); app.use(express.static('public&ap ...

The Link Element Does Not Appear Properly When Styled Using nth-of-type Selector

https://codesandbox.io/s/damp-worker-k7fj6y?file=/src/App.js Can anyone help me understand why the fourth .content <Link/> is not displaying when using the given CSS styling? Could it be a bug in the code, or am I overlooking something important? ...

The information seems to not be getting transferred to the req.body variables from the HTML form

Within my server-side settings using knex and express, I have defined the following function: // POST: Create new users app.post('/add-user', (req, res) => { const {firstName, lastName, emailAdd, gender, dob, password} = req.body; cons ...

Quantifying the passage of time for data entry

Looking to create a quiz form where I can track how long it takes users to input/select answers. I attempted the following code but the timing seems off: $('input, select').on('focus', function(event) { el = $(this); name ...

What is the best way to transfer information from a server running Express.js to a client using React.js?

When using Express.js, I have the ability to send an HTML file that includes a React component. app.get('/index', function(req, res) { res.sendFile(path.join(__dirname + '/src/index.html')); }); Suppose I want to send a uniqu ...

Exploring the potential of Angular JS and gapi in building a seamless routed

I'm facing a similar challenge as described in this question. However, the key difference is that I require two controllers for two distinct routes, essentially representing two different tables: ../table1 and ../table2. Each table needs to fetch data ...

Using a variable in a Joomla module to create a JavaScript object with PHP

I am currently developing a Joomla module that features a progress bar utilizing the ProgressBar.js plugin. Since this module is designed to load multiple objects on a single page, hardcoding the IDs of these objects is not feasible. To address this, I uti ...

The parameters remain consistent across all Angular directives

I have created a directive called 'filterComponent' with the following code: app.directive('filterComponent', function() { return { restrict: 'E', templateUrl: 'filter-component.html', link: function ...

Easily accessible jQuery tabs with the option to directly link to a specific tab

I currently have tabs set up on my webpage. The code for these tabs is as follows: $('ul#tabs li a').click(function(){ var id = $(this).attr('id'); var counter = 1; $("ul#tabs a.current").removeClass('cur ...

audio enhancement in a web-based game

I'm having trouble getting a sound effect to play consistently in my game whenever there is a hit. Sometimes the sound plays, other times it does not! Here is the code I am using: <script> var hitSound = new Audio(); function playEffectSound ...

Divide the number by the decimal point and then send it back as two distinct parts

Let's tackle a challenging task. I have a price list that looks like this: <span class="price">10.99€/span> <span class="price">1.99€/span> My goal is to transform it into the following format: <span class="price">10< ...

Unauthorized changes made without verification

I'm in the process of developing a website that allows users to post without needing to create an account. Upon posting, users will be prompted to enter their email address. After posting, users will receive an email with a unique URL that grants th ...