Challenge 1: An index View — Solution

All Posts

=begin Notes: - <% @posts.each do |post| %> uses the logic-only tag (no =) because a loop itself doesn't produce a value to output -- only the things inside it do. - <%= post.title %> uses the output tag, since this is exactly what needs to appear on the page, escaped automatically per the chapter's coverage of automatic escaping. - <% if post.published? %> is also logic-only -- it decides WHETHER the "(Published)" text appears, but the conditional check itself produces no visible output. - Every <% %> block that opens (each do, if) needs a matching <% end %>, exactly like Ruby's own block/if syntax from Course 1 -- ERB doesn't invent new syntax here, it embeds real Ruby control flow directly. =end