Search code examples
ruby-on-railssorcery

ActiveRecord::StatementInvalid in UsersController#create when I use sorcery gem


I followed everything about sorcery in railscasts but when I tried to create a user, it gives me this error

SQLite3::ConstraintException: users.username may not be NULL: INSERT INTO "users" ("created_at", "crypted_password", "email", "salt", "updated_at") VALUES (?, ?, ?, ?, ?)

please help me to fix this problem, please go have a look my github:https://github.com/simpsonness/test_app

Thanks~~~


Solution

  • If you don't want to use username column, create a migration that would delete it:

    bundle exec rails g migration remove_username_from_users username:string
    

    and run it. Otherwise, add :username to permitted params in your UsersController#user_params private method and add appropriate field to your view.