-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Errors not connected with visible fields
Benjamin Robinsion edited this page Feb 1, 2016
·
3 revisions
In order to render error messages that are not connected with any of the visible fields you can use:
= f.error :field_name
Example, order
needs at least one item
= simple_form_for @order do |f|
= f.error :items # here error message about no associated items will be rendered
= f.simple_fields_for :items do |item|
= render item
This page was created by the OSS community and might be outdated or incomplete. Feel free to improve or update this content according to the latest versions of SimpleForm and Rails to help the next developer who visits this wiki after you.
Keep in mind to maintain the guides as simple as possible and to avoid additional dependencies that might be specific to your application or workflow (such as Haml, RSpec, Guard and similars).