开发者

Rails/Devise changing min length of username

Rails 3.0 Authlogic 2.1.6

Using username (not email) for authentication.

Authlogic requi开发者_如何转开发res username to be at least 3 characters.

How does one convince Authologic to allow a 2 character username?

Thanks for your help.


You can override the authlogic default username length by adding the following code to models/user.rb

class User < ActiveRecord::Base

  acts_as_authentic do |c|
    c.merge_validates_length_of_login_field_options :within => 4..100
  end

  #....

end

This assumes your user model is called User

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜