Add validation for custom fields in the devise_invitable prompt form

As I know, devise has only email and password validation, which can be reconfigured in the initializer devise.rb:

# ==> Configuration for :validatable # Range for password length. Default is 6..128. # config.password_length = 6..128 # Regex to use to validate the email address # config.email_regexp = /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i 

How do I add confirmation for custom fields that have been added to the devise_invitable prompt form?

For example, I need a check for the first_ and last_ names in the form:

 = simple_form_for resource, :as => resource_name, :url => invitation_path(resource_name) do |f| = f.input :first_name = f.input :last_name = f.input :email = f.button :submit 

Thanks in advance!

+6
source share

Source: https://habr.com/ru/post/893458/


All Articles