Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails requests pending on Google Chrome

I do not know if this is a common problem or not. But I have a strange problem in my Ruby on Rails application.

For example in Chrome:

When I click a link_to or I try to change page it will load, and load, and load and the page won't simply open. To open I need to click open in another tab and close the current tab, that way the page will be loaded correctly. I don't know what the hell is going on, It just started to happen from one moment to another.

In Firefox:

The problem above does not happen but it does not show me the most recent html unless I refresh with F5. Then it shows all the content corretly except the first time.

I am using Linux to run my project and it is localhost. Both scenarios are very strange and I think they are related somehow. I already cleared both caches in both browsers.

Update:

As suggested made a search for turbo links. I have the gem installed but the only place where I am using turbo links is in application.html.erb.

<%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>

Example:

When I click the Sign In property which is:

<li> <%= link_to "Sign up", new_member_registration_path, :class => 'navbar-link'  %> </li>

The call is pending and does not move (at Chrome), here is a picture of the network:

Picture of the Network Status during the link to above in my application

There is no prints at my console logs, nothing it just gets stuck and do nothing.

like image 337
heisenberg Avatar asked Jul 21 '16 08:07

heisenberg


2 Answers

Removing the turbolink feature from the application will solve your problem. Here are the steps:

  1. Remove the gem 'turbolinks' line from your Gemfile.
  2. Remove the //= require turbolinks from your app/assets/javascripts/application.js.
  3. Remove the two "data-turbolinks-track" => true hash key/value pairs from your app/views/layouts/application.html.erb. Cheers
like image 199
Abid Iqbal Avatar answered Oct 18 '22 07:10

Abid Iqbal


I think the problem could be related with Turbolinks.

To check if that's the case try to disable it and check if problems still occur.

To disable Turbolinks you can follow these simple steps (http://blog.steveklabnik.com/posts/2013-06-25-removing-turbolinks-from-rails-4)

like image 30
Lorenzo Angelini Avatar answered Oct 18 '22 07:10

Lorenzo Angelini