devise_token_auth 보석을 사용하면 this question과 비슷하게 json 응답에서 두 번 나타나는 유효성 검사 오류!? 로그에서Rails 5.1 : devise_token_auth는 1을 찾았을 때 2 개의 에러를 반환합니다.
다음 unpermitted_parameters 라인이 두 번 표시되어 있는지
Processing by DeviseTokenAuth::RegistrationsController#create as JSON
Parameters: {"name"=>"Mickey Mouse", "email"=>"[email protected]", "password"=>"[FILTERED]", "confirmPassword"=>"[FILTERED]", "confirm_success_url"=>"http://localhost:4200/register", "registration"=>{"name"=>"Mickey Mouse", "email"=>"[email protected]", "password"=>"[FILTERED]", "confirmPassword"=>"[FILTERED]", "confirm_success_url"=>"http://localhost:4200/register"}}
Unpermitted parameters: :confirmPassword, :confirm_success_url, :registration
Unpermitted parameters: :confirmPassword, :confirm_success_url, :registration
(0.2ms) BEGIN
User Exists (0.9ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = $1 LIMIT $2 [["email", "[email protected]"], ["LIMIT", 1]]
(0.8ms) SELECT COUNT(*) FROM "users" WHERE "users"."provider" = $1 AND "users"."email" = $2 [["provider", "email"], ["email", "[email protected]"]]
(0.3ms) ROLLBACK
Completed 422 Unprocessable Entity in 247ms (Views: 0.7ms | ActiveRecord: 6.9ms)
공지 사항 - (그 선이 우편 배달을 통해 표시되지 않습니다) 뭔가 이상한을 나타내는 것으로 보인다.
내 사용자 모델에는 표준 가이드가 추가되어 있지 않으므로 모델에 고유성 또는 존재 확인이 2 가지가 아니며 보석의 소스 코드를 조사해도 그 사실이 나타나지 않습니다.
{
"status": "error",
"data": {
"id": null,
"account_id": null,
"provider": "email",
"uid": "",
"name": null,
"nickname": null,
"image": null,
"email": "[email protected]",
"created_at": null,
"updated_at": null
},
"errors": {
"email": [
"has already been taken",
"has already been taken"
],
"full_messages": [
"Email has already been taken",
"Email has already been taken"
]
}
}
레일즈 API가 Angular2에서
라고 :class User < ActiveRecord::Base
# Include default devise modules.
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:confirmable, :omniauthable
include DeviseTokenAuth::Concerns::User
end
나는 우체부에서이 엔드 포인트를 호출 할 경우, 나는이 같은 결과를 얻을 수는 여기에 반환 된 JSON입니다 : 여기
모델입니다 angular2-token 라이브러리를 사용하지만 분명히 문제는 아닙니다 (우편 배달부의 결과 제공).이 오류의 원인을 어떻게 알 수 있습니까? 2 번째 오류를 제거하기 위해 어떻게 원숭이 패치를 할 수 있습니까? 내가 모델에서 :validatable
을 제거하고 내 자신의 유효성 검사를 넣으면
UPDATE
는 :
validates_uniqueness_of :email
을 나는 이상한 동일한 결과를 얻을.
그것은 이상한 것이 아니지만'uniq' 오류 메시지 배열을 사용하기 전에. – pdoherty926
@ pdoherty926 이것은 보석 상자 위에 만들어진 보석에있는 것을 제외하고는 그렇게하고 싶습니다. 그리고 나는 어떻게 든 원숭이 패치를함으로써 장치 등록 컨트롤러에서 그들에게 접근 할 수있는 방법을 알아 내야 할 것입니다. 친절한 (전에는 한 번도 해본 적이 없어) – rmcsharry