If you need errors on the base object, use not any specific attribute:
errors.add(:base, "Here goes my custom message")
As for the brackets and quotes, I think it depends on how you set your errors. When you just say @post.errors[:base] , it will return an array. This warning just literally spits out the array. You will probably want to sort through the errors or just grab .first if there is only one.
In addition, calling .html_safe will take care of the " .
source share