While creating a personal app, an event occurred that suddenly made it impossible to register as a group: scream:
The cause was the validation I added to the users model: persevere: (To find the cause, I created the app from scratch and spent 4 days talking about it ...)
I will leave it as a memorandum!
Looking at the log, the params are ROLLBACKed even though the data is properly retrieved: rolling_eyes: The content of the error is ** invalid **.
The bad code was the validation I added to the users model: angry:
app/models/user.rb
validates :password, presence: true, length: {minimum: 8 }
Password 7 characters or less is a description that causes an error.
Perhaps the validation added to the user model made it necessary to get password data when registering a group? ?? Is it? ?? If anyone knows, please let me know: bow_tone1:
I solved it by adding an option to the validation added to the users model!
app/models/user.rb
validates :password, presence: true, length: {minimum: 8 },on: :create
Validation is used only when registering as a user! It means that.
First of all, it is an event that the cause is found by recreating the application from scratch in the situation where registration is suddenly impossible and the cause is unknown. .. .. It was really painful: sob: I solved it by adding only 11 character code, but I think I got a lot of things in a way: laughing:
● I found a clue to solve password validation. https://qiita.com/noriya1217/items/f0e887f3a7b2c7f83722
● I referred to the validation options. https://qiita.com/Shantti-Y/items/19ea23b81f3421063fc5
Recommended Posts