'Rails Devise - changing minimum password length for a particular user model
Is it possible to have a different devise config for a specific model? I want to have the minimum password length for all user models set to 8 characters, But for Admin model I want to set it to 12 and for another model, say Student, I want to set it to 4. Is that possible?
I tried this:
devise :validatable
self.password_length = 4..128
inside my student.rb model, but it didn't seem to work!
Solution 1:[1]
I found the answer. No need to set self.password_length
. We can just do this:
devise :validatable, password_length: 8..128
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |