how to conditionally add class in html code example Example: html.erb conditionally add class <div class="<%= @error ? 'error-class' : 'normal-class' %>">