Ruby on Rails Thursday, April 28, 2016

"Agile Web Development with Rails 5", p.76 lists a form partial which

<%= form_for(product) do |f| %>
<% if product.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(product.errors.count, "error") %> prohibited
this product from being saved:</h2>

<% product.errors.full_messages.each do |message| %>
<li><%= message %></li>

It is correct but I'm confused about the first line as I understood that
control structures begin with <% as in the 2nd line and that <%= is
reserved for inserting values and calling formatting functions.


You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment