I’m following the Ruby of Rails getting started guide, and I see this code in the layout file:
<!DOCTYPE html>
<html>
<head>
<title>Blog</title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body style="background: #EEEEEE;">
<%= yield %>
</body>
</html>
Coming from an MVC3 background, is this the equivalent to the RenderContent() method one would invoke from the _layout.cshtml file?
The functionality is about the same in that context, yes. However,
yieldin general is a keyword in the ruby language, concerning blocks. You can find more information here: ruby blocks.Building on that, you are able to provide content for different parts, using
content_for(:something)andyield :something(theyieldpasses:somethingto the layout engine, the layout engine fills in the content for it).