public
Created

  • Download Gist
application.html.erb
HTML+ERB
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<!DOCTYPE html>
<html>
<head>
<title>MyApp</title>
<%= stylesheet_link_tag "application", media: "all" %>
<%= yield :stylesheets %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
<%= javascript_include_tag "application" %>
<%= yield :javascripts %>
</body>
</html>
my_view.html.erb
HTML+ERB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<table>
[...]
</table>
<!-- my content -->
 
<% content_for :javascripts do %>
<%= javascript_include_tag "custom_js" %>
<script>
// put js here
</script>
<% end %>
 
<% content_for :stylesheets do %>
<%= stylesheet_link_tag "custom_css_file" %>
<% end %>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.