I want the rails form to display errors by column.

Asked 2 years ago, Updated 2 years ago, 64 views

All errors are currently displayed in one place using errors.full_messages.each.

I want this to appear in the display just above each column with an error, but I don't know how to do it.

Could you please let me know?

ruby-on-rails ruby

2022-09-30 21:17

1 Answers

If you want to write solidly, you can get it as an array with errors.full_messages_for(:attributes) for each attribute (empty array if there are no errors), so you can use the results to print it out.


2022-09-30 21:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.