私は、プロジェクトの反応レールを経由して、Rails 4、Devise for auth、React.JSをビュー用に使用しています。反応レールの登録フォームの問題
現在、カスタム登録作業を行っています。私はドキュメントを段階的に辿り、私のルーティングを私のUser/registrations_controllersにカスタマイズし、すべてのことがぎりぎりとしたものになった。
私はjqueryを使用してフロントエンドのフォームからajaxを起動しています。現在、テストのためにいくつかのデータをハードコードしています。
今私はそれを送信しているときにパスワードと電子メールを見つけることができないと言う422応答を得ています。しかし、それは渡された他の値について何も言及していないので、それはまだデフォルトのエンジンエンジンに行くようです...どんな助けもいいと思います。私はdeviseが設定するのが難しいという評判を持っています。
ここに私のコントローラ機能 -
def create
@user= User.new(configure_sign_up_params)
respond_to do |format|
if @user.save
format.html { redirect_to @user, notice: 'User was successfully created.' }
format.json { render :show, status: :created, location: @user }
else
format.html { render :new }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
はここに私の強力なパラメータはこれは私がJSOn.stringify'ing-
let formData =
{
"username": "test", // document.getElementById('username').value
"password": "1234",
"password_confirmation": "1234",
"email": "[email protected]",
"membership": "community"
}
後に送信していたデータである
def configure_sign_up_params
devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:email, :password, :password_confirmation) }
end
を機能 - だです
これは私のネットワークレスポンスになっているエラーです。このボディでは422です。
{"email":["can't be blank"],"password":["can't be blank"]}
ありがとうございます!