Skip to content

Instantly share code, notes, and snippets.

@ro31337
Created December 27, 2017 18:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ro31337/34a65b57f7e1f9c7b7cc954119e2e2a8 to your computer and use it in GitHub Desktop.
Save ro31337/34a65b57f7e1f9c7b7cc954119e2e2a8 to your computer and use it in GitHub Desktop.
Your views:
=== show.html.erb ===
<% content_for :header do
stylesheet_link_tag 'blabla'
end %>
<% content_for :header do
javascript_include_tag 'blabla'
end %>
<div>
... actual view goes here ...
</div>
===
Your layout (note the line 26):
=== app/views/layouts/application.html.erb ===
<!DOCTYPE html>
<html>
<head>
<title>App</title>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= content_for(:header) %>
</head>
<body>
<%= yield %>
</body>
</html>
===
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment