开发者

Add validation for custom fields in invitation form of devise_invitable

开发者 https://www.devze.com 2023-03-22 19:01 出处:网络
As I know, devise has validation only for email and password, which can be reconfigurated in initializer devise.rb:

As I know, devise has validation only for email and password, which can be reconfigurated in 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 add validation for custom fields, which has been added into invitation form of devise_invitable?

For example, I need validation for the first_ and the 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!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号