I was recently playing around with rendering inline errors using the normal Ruby on Rails view stack, when I came across this blog post. There’s certainly some interesting stuff in there, but one of the things that stuck out to me particularly is how the
field_error_proc attached to the base ActionView class can be modified to render inline errors by default.
I did some looking around to try and learn more about how this proc is inserted into forms built with the Rails form helpers, and I struggled to find information on the topic. I couldn’t find anything exposed on the API docs, and the only thing that I found in Rails Guides is this section on changing the proc using the Rails’ configuration features. A particularly frustrating part of this is not knowing how the Rails form builder processes this proc, and what methods the default arguments for this proc respond to.
I was wondering if anyone could provide some historical context as to why this feature exists as part of the form builder, and if there’s a prescribed way to interact with it. Given current trends in web design, it seems like this could be a really useful feature, but it seems to be something that’s difficult to find information on, and that many people don’t take advantage of.
I hope that this topic can spark some conversation around the feature. I’d love to hear all of your experiences or insights into this topic.