Q: Rails 4 TurboLinks not disabling from link in layout I have a rails 4 project that has some public routes (home, contact, about) and then some routes that are only for logged in users that are name spaced under admin (admin/home, admin/contact, admin/about). The admin routes basically edit and update what is displayed in the public routes.
I have an admin layout for the admin routes and a application layout which does the normal public routes. My admin layout has to have data-no-turbolink in the body because I NEED to disable turbolinks in order for the CKEditor gem to work properly.
Each layout has a link that shows up if a User is logged in. So if a user is logged in and visits "localhost:3000/" or "http://localhost:3000/contact" etc, there will be a link that will link to the admin page.
Likewise if a logged in user visits "http://localhost:3000/admin/home" or "http://localhost:3000/admin/contact" there will be a link that links to the public page. Here is what the layouts look like.
ADMIN LAYOUT
<!DOCTYPE html>
<html>
<head>
  <title>TITLE</title>
  <script src="//cdn.ckeditor.com/4.4.6/basic/ckeditor.js"></script>
  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => false %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => false %>
  <%= csrf_meta_tags %>
</head>
<body data-no-turbolink>
  <div class="page-wrap">
    <header id="main-head">
    <%= render "nav"%>
    </header>
    <% if logged_in %>
      <div id="review-default"><%= link_to "Preview Pages As A Regular User.", root_path  %></div>
    <% end %>
    <%= yield %>
  </div>
</body>
</html>

APPLICATION LAYOUT
<!DOCTYPE html>
<html>
<head>
  <title>TITLE</title>
  <script src="//cdn.ckeditor.com/4.4.6/basic/ckeditor.js"></script>
  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
</head>
<body>
  <div class="page-wrap">
    <header id="main-head">
    <%= render "nav"%>
    </header>
    <% if logged_in %>
      <div id="review-admin"><%= link_to "Return to Admin Panel.", admin_home_path  %></div>
    <% end %>
    <%= yield %>
  </div>
</body>
</html>

My problem is that when I click from say the root path "/" to "admin/home" the forms that CKEditor is applied to dont display properly until I refresh the page, which leads me to think that they are not displaying properly because turbo links are not disabled. 
But when I, for example, log in and get directed to the adminroutes they are disabled. But they dont seem to be when I am linked to them from the links in the layout...
I hope that makes sense.
What am i doing wrong and how do I stop turbo links from being applied to my admin routes?
EDIT
my solution was to add 
<% if logged_in %>
<body data-no-turbolink>
  <% else %>
<body >
  <% end %>

to both my admin and application layouts. This solves my problem, but if anyone has a more elegant solution (since if the admin layout is being called correctly by having layout "admin" in my admin controller it doesn't seem like I would have to do this), I am all ears!
BTW, I love you StackOverFlow. Thank you for all your patience and help.

A: my solution was to add
<% if logged_in %>
<body data-no-turbolink>
  <% else %>
<body >
  <% end %>

to both my admin and application layouts. This solves my problem, but if anyone has a more elegant solution (since if the admin layout is being called correctly by having layout "admin" in my admin controller it doesn't seem like I would have to do this), I am all ears!
