Home > Blockchain >  How set a boolean value using curl command to populate database, Rails
How set a boolean value using curl command to populate database, Rails

Time:10-22

I'm building a rails API and using curl to test and populate the Users table, and set the admin column to true. The default is false.

curl -XPOST -H "Content-Type: application/json" -d '{ "user": { "email": "[email protected]", "password": "12345678", "admin": "TRUE" } }' http://localhost:3000/api/signup

The command above fails and admin value is always set to false no matter what. I have also tried true, 1, "1" but nothing works.

CodePudding user response:

Simply just override Devise's sign_up_params

https://stackoverflow.com/a/16196732/8050183

def sign_up_params
   params.require(:user).permit(:email, :password, :password_confirmation, :other, :etc)
end
  • Related