<%= form_with(model: restaurant) do |form| %>
<% if {restaurant.errors.any} %>
<div style="color: red">
<h2><%= pluralize(restaurant.errors.count, "error") %> prohibited this restaurant from being saved:</h2>
<ul>
<% restaurant.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
</div>
<% end %>
<div>
<%= form.label :name, style: "display: block" %>
<%= form.text_field :name %>
</div>
<div>
<%= form.label :address, style: "display: block" %>
<%= form.text_field :address %>
</div>
<div>
<%= form.label :phone, style: "display: block" %>
<%= form.text_field :phone %>
</div>
<div>
<%= form.label :website, style: "display: block" %>
<%= form.text_field :website %>
</div>
<div>
<%= form.submit %>
</div>
<% end %>
Getting and Error in my If statement
AntonGreen
#1
0 Likes
OdatNurd
#2
Your post doesn’t contain a question, an outline of what is happening, or an indication of what you actually want to happen instead.
If you want to get an answer to your question, you may want to consider adding those to entice people who won’t otherwise understand your question (for example I don’t even know what language this is supposed to be).
2 Likes
bschaaf
#3
The error is probably that any
is not defined (should be any?
). This forum is for Sublime Text questions, not generic Ruby on Rails or other non-sublime related programming.
1 Like