1. Conclusion </ b>
2. What is ActiveRecord :: NotNullViolationt </ b>
3. Why ActiveRecord :: NotNullViolation in Devise </ b>
4. How to solve it </ b>
5. Supplement </ b>
in db / migrate / "" "" devise_create "" "" ".rb Delete the "t.string password (or password_confirmation)" </ b> description!
This means "Items that should not be left blank (NULL) due to DB rules are about to be saved as data! You can't do that!" </ B> It's pointed out!
When multiplied by 2, it says, "Items that should not be left blank (NULL) on the device are about to be saved as data! It is when it is saved and registered with the controller!" ..
The reason for this is that gem'devise' created a password for me. I'm trying to make it over, so I don't know which password is better and it seems that it became NULL!
gem'devise' is a gem that creates a password and a password_confirmation for it!
So
db/migrate/""""_devise_create_""""".rb
t.string :password null:false"(password_confirmation)
You don't have to program to create columns!
db/migrate/""""_devise_create_""""".rb
t.string password, null:false"
(Or password_confirmation)
I think it is written, so let's delete it!
By the way, gem'devise' has another feature added to password!
It's validation </ b>!
Since there is already a restriction as a function so that you can not enter unless it is 6 characters or more
model/user
validates :password, length { minimum: 5 }
No need to list!
Recommended Posts