Rails group validation with just one error message
- by Victor
The following validation code in the model:
validates :formatted_address, :zip, :city, :state, :country, :presence => true, :message => "is incomplete. Please enter full address."
is displayed when either of the fields are empty. Let's say now :address and country are empty, 2 errors are displayed:
Formatted Address is incomplete. Please enter full address.
Country is incomplete. Please enter full address.
How can I group the error message in the validation to just show one error message if either of the fields validated does not exist?
Address is incomplete. Please enter full address.
Thanks.