You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"children": [
"The property '#/0' did not contain a required property of 'gender' in schema file:///Users/navneet/rails_app/components/core/app/models/schemas/children.json"
]
Is there any way to change the message format similar to:
Yes you’re right, the default error message is invalid_json, which is then translated by ActiveRecord.
The way you’re using the message option is correct — you could pass the errors argument through a custom method to parse errors into a structured hash:
classFoo < ApplicationRecordvalidates:children,json: {message: ->(errors){Foo.parse_json_errors(errors)},schema: CHILDREN_SCHEMA}defself.parse_json_errors(errors)# Here, you can parse the `errors` array into something more meaningfulendend
I am using it in a engine
core
, onRails 5.2.0
I am not getting proper error message
After adding
:message
optionThe error message is:
Is there any way to change the message format similar to:
Any suggestions will be helpful.
The text was updated successfully, but these errors were encountered: