尝试通过模态窗口从我的主页提交我的注册表单时,我收到错误“未找到参数:用户”。
ActionController::ParameterMissing in UsersController#create
param not found: user
def user_params
params.require(:user).permit(:email, :password, :password_confirmation)
end
这是传入的参数。
Parameters:
{"utf8"=>"✓",
"authenticity_token"=>"eXXn7+Rsf4SLciRPn4RW8Lw+3u6/FJZi8IW2XxekYsU=",
"email"=>"asdf@asdf.com",
"password"=>"[FILTERED]",
"password_confirmation"=>"[FILTERED]",
"commit"=>"Sign up"}
这是 users_controller.rb
class UsersController < ApplicationController
def new
user = User.new
end
def create
user = User.new(user_params)
if user.save
auto_login(user)
redirect_to root_path
else
render :new
end
end
private
def user_params
params.require(:user).permit(:email, :password, :password_confirmation)
end
end
在我看来一切都很好,但显然有些地方出了问题。有人有想法么?谢谢!