我收到消息错误
render :json=> {"status"=>"failed",:errors=>@user.errors.messages}.to_json
{
"status": "failed",
"errors": {
"Email": [
"has already been taken"
],
,
"Username": [
"has already been taken"
]
}
}
但我想自定义错误:
{
"status": "failed",
"errors": {
"error": [
"Email has already been taken"
],
,
"error": [
"Username has already been taken"
]
}
}
请帮我解决这个问题。感谢您的支持。