Just launched! Get 30% off Rails Revisited Have a Look

Creating a Sales Page: The Layout

Buy or Subscribe

You can access this course in just a minute, and support my efforts to rid the world of crappy online courses!

Buy Standalone  Subscribe

When you work with a Repeater, you have to loop over its elements:
<% current_page.content(:problem).each do |p| %>
<h2<%=p.content(:title)%></ph2
<p><%=p.content(:summary)%></p>
<% end %>
You can also wrap this with an if statement if you're not sure whether a bit of content is present:
<% if(current_page.content(:problem).present? %>
...
<% end %>
I find that working with partials is much easier, because you can plug them in where you need them. They can work like components in a Vue or React app as well.
For instance, my "hero" partial doesn't need to access the current_page stuff, you can pass the page to it, like this:
<%= render "hero", locals: {page: current_page.content(:problem).first } %>
A bit verbose, but it does separate the hero from the implementation details.