Inline form error messages

I’ve been searching for a solution to inline form error messages without
using a plugin.

For example, for the Email field, this is what I came up with…


<%= user_form.label :email %>
<%= user_form.text_field :email %>
<% unless @account.errors[“companies.users.email”] == nil %>
Email <%= @account.errors[“companies.users.email”][0] %>
<% end %>

It works just fine, but I was wondering if you might have a suggestion
to simplify the code. I’m a newbie and I don’t always write code the
most concise way.