I have a very similar issue than this one. I recently added has_secure_password
to my User model. Everything is working great, except when I try to create a user from Facebook, which have a :friends attribute. In this case, i have this error when I try to @user.save!
> Validation failed: Friends is invalid
FB user creation was working perfectly before I added has_secure_password, and is still working when I save the users with @user.save(validate: false)
Once the user is already created and present in the database, the @user.save!
method is working and the :friends are validated.
I also have a validates :password, length:{minimum:8}, on: :create
in my User model, but the friends validation is still triggered even if I remove this line.
I could add a has_facebook?
condition in my controller to completely skip any kind of validation when I try to create a user from FB, but I really want to understand why has_secure_password validation is triggered for something seemingly unrelated.
Aucun commentaire:
Enregistrer un commentaire