I’m looping through errors in a user#update using the following HAML:
- if @user.errors.any?
.alert.alert-error
%ul
= @user.errors.full_messages.each do |msg|
%li= msg
However, instead of just displaying the message, I also get square brackets:
First name can't be blank ["First name can't be blank"]
What am I doing wrong?
EDIT:
If I do p msg then the console tail shows only the message, but within the <li> the brackets still render.
I figured it out.
The line:
= @user.errors.full_messages.each do |msg|should have read:
- @user.errors.full_messages.each do |msg|Haml was printing out the array on top of doing the loop.