Gem 请问在 Devise 中,在注册时如何重复确认某个字段。

whitecrow · July 23, 2012 · Last by whitecrow replied at July 23, 2012 · 1730 hits

比如密码,很多网站在注册时,要求再次输入密码。如果是其它字段,又比如 Email,该如何做呢?

增加一些验证可以实现吧。

validate :reqired_active_code,:on => :create

def reqired_active_code

    if ("010345782"!= @_active_code) then
      errors.add(:active_code, "企业激活码不正确")
    end
  end

@jimrokliu 非常非常感谢 :)

You need to Sign in before reply, if you don't have an account, please Sign up first.