true do |t|" />
开发者

Devise login validation failure

I rails3.0.4 and devise installed with following users table

create_table "users", :force => true do |t|
    t.string   "login"
    t.string   "email"
    t.string   "crypted_password",         :null => false
    t.string   "password_salt",            :null => false
    t.string   "persistence_token",        :null => false
    t.string   "single_access_token",      :null => false
    t.string   "perishable_token",         :null => false
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "database_authenticatable", :null => false
   开发者_Go百科 t.string   "recoverable"
    t.string   "rememberable"
    t.string   "trackable"
    t.string   "reset_password_token"
  end

The users table was not created by devise but I added the necessary columns in migration. And following settings in config/initializers/devise.rb

config.authentication_keys = [ :email]

But every time I try to sign up as a new user it throws:

  2 errors prohibited this user from being saved:
  Login is too short (minimum is 3 characters)
  Login should use only letters, numbers, spaces, and .-_@ please.

Any ideas why it could happen?


Yes, the login is too short and/or contains the wrong characters :) You enabled the devise built-in validations, and that's what they validate. To use your own validations remove :validatable from your devise inclusion in app/models/user.rb

If you're interested, the validation used by devise is defined in lib/devise/models/validatable.rb in the devise gem.

Should the validation not be the problem you'll have to show the log of a user creation request, so that we can see what parameters are submitted.

EDIT: Oh I see, I misread - it's about "login". Well, see comments below.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜