Turbolinks not working

61 views
Skip to first unread message

Jeremy Montesinos

unread,
Dec 2, 2015, 11:53:44 AM12/2/15
to rubyonra...@googlegroups.com
Hi,

i'm working on a project in Rails. When I click on a "link_to" button
turbolinks is not working. But when I create a "<a>" link, it's working
!
Why ?
I use Google chrome for look if it working. But in firefox it's not
working too.
My app.js :
//
//= require jquery
//= require bootstrap-sprockets
//= require ckeditor/init
//= require jquery_ujs
//= require jquery.turbolinks
//= require bootstrap-slider
//= require jquery.tablesorter.min
//= require jquery.tablesorter.widgets.min
//= require fixedheadertable
//= require nprogress
//= require nprogress-turbolinks
//= require turbolinks
//= require_tree .


My app.html.erb <head>:
<head>
<title><%= @title + " - Tick{Master}" %></title>
<%= stylesheet_link_tag 'application', media: 'all',
'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' =>
true %>
<%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>

My two links :
<li><%= link_to "Tous les incidents", incidents_url, class: "",
:method => :get %></li>
<li><a href="/incidents">Tous les incidents</a></li>


The gem 'jquery.turbolinks' not working too.

Sorry for my poor English, i'm french. Thanks!

--
Posted via http://www.ruby-forum.com/.

Colin Law

unread,
Dec 2, 2015, 12:09:13 PM12/2/15
to Ruby on Rails: Talk
On 2 December 2015 at 16:11, Jeremy Montesinos <li...@ruby-forum.com> wrote:
> Hi,
>
> i'm working on a project in Rails. When I click on a "link_to" button
> turbolinks is not working. But when I create a "<a>" link, it's working

How do you know it is not working?

Show us the source of the link_to and copy/paste the html that it
produces by viewing the source in the browser (ctrl+u in firefox).
Just the html around the link.

Colin
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6ae8d4ccaf2a07384291488fa596f8dd%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.

Jeremy Montesinos

unread,
Dec 3, 2015, 5:35:47 AM12/3/15
to rubyonra...@googlegroups.com
The Html :
<!DOCTYPE html>

<html>
<head>
<title>Créer un incident - Tick{Master}</title>
<link rel="stylesheet" media="all"
href="/assets/application-48635ecbfd04c21cac23ad45e33990ff.css"
data-turbolinks-track="true" />
<script
src="/assets/application-29908a8c5d000f4f4bea87116f40c8ae.js"
data-turbolinks-track="true"></script>
<meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token"
content="kKhRcB6y5NttaYZ6v89/MJL2wotkM4WLiuRowjoEM8EPP4Q+k6Vl8aNnUxi+0ej2gj7j7LepkuFH1TBOzof/mQ=="
/>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body id="connected"></body>
<!--Header-->
<div class="nav-side-menu">
<a class="brand">
TickMaster
</a>
<i class=" fa fa-bars fa-2x toggle-btn" data-toggle="collapse"
data-target="#menu-content"></i>
<div class="menu-list">
<ul id="menu-content" class="menu-content collapse out">
<li class="new_incident_button"><a href="/incidents/new"><img
alt="" class="fa-img"
src="/assets/ICOMOON/32px/0267-plus-878a8aefb2fc5f160df23f8f02b74011.png"
/></a>
<a href="/incidents/new" data-no-turbolink="true">
<i class="fa fa-dashboard fa-lg">Nouvel incident</i>
</a>
</li>


<li data-toggle="collapse" data-target="#incidents"
class="collapsed active"><img alt="" class="fa-img"
src="/assets/accidents-aeb9ce9e10abf41731af384353820dc9.png" width="32"
height="32" />
<a href="#"><i class="fa fa-gift fa-lg"></i>Incidents</a>
</li>
<ul class="sub-menu collapse" id="incidents">
<li><a class="" data-method="get" href="/users/1">Mes
incidents</a></li>
<li><a class="" data-method="get"
href="http://localhost:3000/incidents">Tous les incidents</a></li>
<li><a href="/incidents">Tous les incidents</a></li>
<li><a data-method="get" href="/users/1/allincidents">Incidents
cloturés</a></li>
</ul>

As you can seen, i have write "data-no-turbolink="true"" at the first
link but not at the others links. So, when i create links with link_to,
turbolinks not working but with <a></a> it's working.

Jeremy Montesinos

unread,
Dec 3, 2015, 11:11:42 AM12/3/15
to rubyonra...@googlegroups.com
Up !

Colin Law

unread,
Dec 4, 2015, 4:37:30 AM12/4/15
to Ruby on Rails: Talk
On 3 December 2015 at 15:59, Jeremy Montesinos <li...@ruby-forum.com> wrote:
> Up !

For me, at least, you have still not provided enough information to
work out exactly what your problem is. I don't know whether you are
saying that your erb source is not producing the correct html (but you
have not shown the erb source so difficult to judge that) or whether
you are saying that the html that you have shown is not performing as
it should (but in that case you have not told us what is not happening
that should).

By the way, to post something and then 'up' it in six hours is
ridiculous. Most of us need at least that much sleep at some time in
the day and many of us only do this in our spare time. Remember that
this mailing list has a world wide audience and we are not all in the
same time zone.

Colin
Reply all
Reply to author
Forward
0 new messages