0

I have added these two lines in my application.html.erb file <%= yield :gal_img_hover_stylesheet %> and <%= yield :gal_imgs_hover_stylesheet %>

<!DOCTYPE html>
<html>
  <head>
    <title>UserGalleryPictureProject</title>
    <%= csrf_meta_tags %>
    <%= yield :gal_img_hover_stylesheet %>
    <%= yield :gal_imgs_hover_stylesheet %>
    <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
  </head>

  <body>
    <%= yield %>
  </body>
</html>

When these are added the link_tos in other actions dont show only on page refresh, they are there in the inspector but are dulled out until I refresh. If I remove yield to these stylesheets the link_to work fine again. I think it has something to do with javascript as removing <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> in application.html.erb links work fine again too.

Is there a way around this because I want the benefits of turbolinks but im not versed enough on where the error is coming from. Obviously when my javascripts arn't loaded into the browser the link_tos work but want to know why.

Lee Eather
  • 345
  • 3
  • 16

1 Answers1

2

You can disable turbolinks on the link_to

<%= link_to('Model', @model, 'data-no-turbolink' => true) %>

and try to put your two yield header in the below the turbolinks and css code or in the body tag

buncis
  • 2,148
  • 1
  • 23
  • 25
  • Hi, thanks. Yes I found [this](https://stackoverflow.com/questions/14227363/using-turbolinks-in-a-rails-link-to) link here which gives the turbolinks 5 syntax `data: { turbolinks: false }`. I will mark as correct but will have to see why is doing that.. – Lee Eather Jun 10 '17 at 07:23