Answer the question
In order to leave comments, you need to log in
Unpermitted parameter: :user?
I send a request to the server
curl -X POST \
http://localhost:3000/user \
-H 'Content-Type: application/json' \
-d '{
"email": "[email protected]",
"password": "123456",
"password_confirmation": "123456"
}'
def user_params
params.permit(
:email, :password, :password_confirmation
)
end
class User < ApplicationRecord
has_secure_password
validates :email, presence: true, uniqueness: true
validates :email, format: { with: URI::MailTo::EMAIL_REGEXP }
validates :password,
length: {minimum:6},
if: -> { new_record? || !password.nil? }
end
Processing by UserController#create as */*
Parameters: {"email"=>"[email protected]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "user"=>{"email"=>"[email protected]"}}
Unpermitted parameter: :user
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question