I was wondering how to output errors from the model a custom way I don’t want to change just the message of the error but also how the error looks when its outputted. Currently i’m using this in my view <%= f.error_messages %>.
Any help will be greatly appreciated.
I recommend using the formtastic gem for the easiest and most powerful form customization.
Or you could subclass ActionView::Helpers::FormBuilder as described in the Advanced Rails Recipes book, though that is more work and arguably not as clean.
If you are simply looking for a way to modify ActiveRecord’s error_messages method,
you could simply modify them directly in your views: