Skip to content

Instantly share code, notes, and snippets.

@markfeedly
Created October 2, 2013 21:41
Show Gist options
  • Save markfeedly/6800922 to your computer and use it in GitHub Desktop.
Save markfeedly/6800922 to your computer and use it in GitHub Desktop.
about.html.erb supplies a title string to application.html.erb, yet application.hrml.erb uses yeild to obtain page content from about.html.erb does this involve some two pass trickery, or failing that what happens here plse?
application.html.erb
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", media: "all",
"data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<%- if notice %>
<p class="alert alert-success container"><%= notice %></p>
<% end -%>
<%- if alert %>
<p class="alert container"><%= alert %></p>
<% end -%>
<div class="container">
<%= yield %>
</div>
<%= render 'layouts/footer' %>
</body>
</html>
about.html.erb
<% provide(:title, 'About') %>
<h1>About</h1>
<%= render :partial => "layouts/trace_where",
locals: {controller_method: 'StaticPages#about', erb: 'app/views/static_pages/about.html.erb'} %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment