Dynamically loaded assets in Rails 4 and Turbolinks

58 views
Skip to first unread message

Seth Portman

unread,
Aug 9, 2013, 2:16:58 PM8/9/13
to rubyonra...@googlegroups.com

I am working on a Rails 4 app in application.html.erb I have the following code

....

<head>

   <title>...</title>

     <%= javascript_include_tag "application", "data-turbolinks-track" => true %>

     <%= yield :head %>

     <%= csrf_meta_tags %>

</head>

What this does is allows me to load certain assets depending on the page I am on. So maybe in the show template of a certain action I could do something like

<% content_for :head do %>

     <%= stylesheet_link_tag "show" %>

<% end %>

This works great and helps me keep the page structured clean and simple. The issue I am having now is that turbolinks is completely ignoring these assets and not even loading them when I click on a next link. I have looked around but cant seem to find an answer to this problem. Any help will be appreciated.

Reply all
Reply to author
Forward
0 new messages