I created a Users controller with the following validation on the password :
validates :password, length: {minimum: 3, message: 'is too short, minimum of 3 characters'}, on: [:create, :update]
But in another controller, I perform this:
def create
user_params = params.require(:user).permit(:email)
@user = User.find_by_email(user_params[:email])
if @user
@user.regenerate_recover_password
...
And so I get the following error :
Validation failed: Password is too short, minimum of 3 characters
The basic idea was to have this validation because otherwise it is possible to use an empty password
Any idea ? Thank's