In my Rails application, admins are people who add users to the system. If the user does not have an email, a password will not be created for him, and he will not be able to log in. But if the user has an email, a password will be created. But the problem is that devise will not allow empty passwords. How can we fix this?
you can override them in your user model:
def password_required? false end def email_required? true end
Edit:
def password_required? new_record? ? false : super end
Source: https://habr.com/ru/post/969835/More articles:Using Devise before_action: authenticate_user! does nothing - ruby-on-railsandroid size layout resizing parent without resizing child elements - androidBootstrap 3: reordering columns on mobile screens - cssHow to count leading zeros in a 32-bit unsigned integer - cWhy are the instance variables listed in validation for subclasses of built-in classes? - inheritanceFragmentStatePagerAdapter onPageSelected event - androidPrevent merging custom upload request on github - githubHow can I get anti-integer elements in SPOJ-DIVREL? - mathWhat does the _ parameter mean in this context? - scalaRemove all unnecessary spaces from a JSON string (in PHP) - jsonAll Articles