Rails 3.0 Authlogic 2.1.6
使用用户名(而不是电子邮件)进行身份验证。
Authlogic要求用户名至少为3个字符。
如何说服Authologic允许使用2个字符的用户名?
感谢您的帮助。
答案 0 :(得分:1)
您可以通过将以下代码添加到models / user.rb来覆盖authlogic默认用户名长度
class User < ActiveRecord::Base
acts_as_authentic do |c|
c.merge_validates_length_of_login_field_options :within => 4..100
end
#....
end
这假设您的用户模型名为User